[26041] | 1 | {combine_css path=$CRYPTO_PATH|cat:'template/style.css'} |
---|
[23209] | 2 | |
---|
[26041] | 3 | {combine_css path=$CRYPTO_PATH|cat:'template/colorpicker/colorpicker.css'} |
---|
| 4 | {combine_script id='jquery.colorpicker' load='footer' path=$CRYPTO_PATH|cat:'template/colorpicker/colorpicker.js'} |
---|
[12617] | 5 | |
---|
[26041] | 6 | {combine_css path='themes/default/js/plugins/chosen.css'} |
---|
[23209] | 7 | {combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'} |
---|
| 8 | |
---|
| 9 | |
---|
[26041] | 10 | {footer_script} |
---|
[26554] | 11 | var time = 0; |
---|
| 12 | |
---|
[23209] | 13 | // colorpicker |
---|
| 14 | $('.colorpicker-input') |
---|
| 15 | .ColorPicker({ |
---|
| 16 | onSubmit: function(hsb, hex, rgb, el) { |
---|
| 17 | $(el).val(hex); |
---|
| 18 | $(el).ColorPickerHide(); |
---|
| 19 | }, |
---|
| 20 | onChange: function(hsb, hex, rgb, el) { |
---|
[26554] | 21 | $(el).val(hex).trigger('change'); |
---|
[23209] | 22 | changeColor(el, hex); |
---|
| 23 | }, |
---|
| 24 | onBeforeShow: function () { |
---|
| 25 | $(this).ColorPickerSetColor(this.value); |
---|
| 26 | } |
---|
| 27 | }) |
---|
[26041] | 28 | .bind('keyup', function() { |
---|
[23209] | 29 | $(this).ColorPickerSetColor(this.value); |
---|
| 30 | changeColor(this, $(this).val()); |
---|
| 31 | }) |
---|
| 32 | .each(function() { |
---|
| 33 | changeColor(this, $(this).val()); |
---|
[19428] | 34 | }); |
---|
[26554] | 35 | |
---|
| 36 | |
---|
[23209] | 37 | $('.button').click(function() { |
---|
[26554] | 38 | $(this).siblings('.button').removeClass('selected'); |
---|
[23209] | 39 | $(this).addClass('selected'); |
---|
[26554] | 40 | $('input[name='+ $(this).data('input') +']').val($(this).data('val')).trigger('change'); |
---|
[23209] | 41 | }); |
---|
| 42 | |
---|
[26554] | 43 | // change button |
---|
| 44 | $('input[name=button_color]').change(function() { |
---|
| 45 | $('#reload').attr('src', '{$CRYPTO_PATH}template/refresh_'+ $(this).val() +'.png'); |
---|
| 46 | }); |
---|
| 47 | |
---|
[23209] | 48 | // apply a preset |
---|
[26554] | 49 | $('input[name=theme]').change(function() { |
---|
| 50 | var id = $(this).val(); |
---|
[19428] | 51 | |
---|
[23209] | 52 | for (key in presets[id]) { |
---|
[26554] | 53 | if ($('input[name="'+ key +'"]').attr('type') == 'radio') { |
---|
| 54 | $('input[name="'+ key +'"][value="'+ presets[id][key] +'"]').prop('checked', true).trigger('change', false); |
---|
| 55 | } |
---|
| 56 | else { |
---|
| 57 | $('input[name="'+ key +'"]').val(presets[id][key]).trigger('change', false); |
---|
| 58 | } |
---|
[23209] | 59 | } |
---|
[12617] | 60 | |
---|
[26041] | 61 | $('.colorpicker-input').each(function() { |
---|
| 62 | changeColor(this, $(this).val()); |
---|
| 63 | }); |
---|
[26554] | 64 | |
---|
[23209] | 65 | changePreview(); |
---|
[12617] | 66 | }); |
---|
| 67 | |
---|
[26554] | 68 | // toggle background type |
---|
| 69 | $('input[name=background]').change(function() { |
---|
| 70 | $('li[id^=background]').hide().filter('#background-'+$(this).val()).show(); |
---|
| 71 | }); |
---|
| 72 | |
---|
[23209] | 73 | // display customization panel |
---|
| 74 | $('.customize').click(function() { |
---|
| 75 | $('#theming').toggle(); |
---|
| 76 | }); |
---|
| 77 | |
---|
| 78 | // change theme to 'custom' if a parameter is changed |
---|
[26554] | 79 | $('input.istheme').change(function(e, p) { |
---|
| 80 | if (p!==false) setThemeCustom(); |
---|
[23209] | 81 | }); |
---|
| 82 | |
---|
| 83 | // update the preview |
---|
[26554] | 84 | $('input.preview').change(function(e, p) { |
---|
| 85 | if (p!==false) changePreview(); |
---|
[23209] | 86 | }); |
---|
| 87 | $('#reload').click(function() { |
---|
| 88 | changePreview(); |
---|
| 89 | }); |
---|
| 90 | |
---|
| 91 | // links for random color |
---|
| 92 | $('a.random').click(function() { |
---|
[26554] | 93 | $(this).prev('label').children('input').val('random').trigger('change'); |
---|
[23209] | 94 | changeColor($(this).prev('label').children('input'), 'random'); |
---|
| 95 | }); |
---|
| 96 | |
---|
| 97 | // multiselect |
---|
| 98 | $("select").css({ |
---|
[26041] | 99 | width: 300 |
---|
[23209] | 100 | }).chosen({ |
---|
| 101 | disable_search:true, |
---|
| 102 | }); |
---|
| 103 | |
---|
[26554] | 104 | function setThemeCustom() { |
---|
| 105 | $('.button[data-input=theme]').removeClass('selected'); |
---|
[14527] | 106 | $('input[name=theme]').val('custom'); |
---|
| 107 | } |
---|
| 108 | |
---|
[26041] | 109 | function changePreview() { |
---|
[26554] | 110 | var now = (new Date()).getTime(); |
---|
| 111 | |
---|
| 112 | if (now-time < 1000) { |
---|
| 113 | return; |
---|
| 114 | } |
---|
| 115 | time = now; |
---|
| 116 | |
---|
[14527] | 117 | options = new Array(); |
---|
| 118 | str = ''; |
---|
| 119 | |
---|
[26554] | 120 | $('input.preview:not([type=radio]), input[type=radio].preview:checked').each(function() { |
---|
[14527] | 121 | options[$(this).attr('name')] = $(this).val(); |
---|
| 122 | }); |
---|
| 123 | |
---|
| 124 | for (x in options) { |
---|
| 125 | str+= '&' + x + '=' + options[x]; |
---|
| 126 | } |
---|
[26041] | 127 | $('#captcha').attr('src', '{$CRYPTO_PATH}securimage/securimage_preview.php?' + new Date().getTime() + str); |
---|
[14527] | 128 | } |
---|
| 129 | |
---|
[12617] | 130 | function changeColor(target, color) { |
---|
[26554] | 131 | if (color == 'random') { |
---|
| 132 | color = '808080'; |
---|
| 133 | } |
---|
[12617] | 134 | if (parseInt(color, 16) > 16777215/2) { |
---|
| 135 | $(target).css('color', '#222'); |
---|
[26041] | 136 | } |
---|
| 137 | else { |
---|
[12617] | 138 | $(target).css('color', '#ddd'); |
---|
| 139 | } |
---|
| 140 | $(target).css('background', '#'+color) |
---|
| 141 | } |
---|
| 142 | |
---|
[26041] | 143 | var presets = { |
---|
[23209] | 144 | {foreach from=$PRESETS key=name item=params} |
---|
[26041] | 145 | "{$name}" : { |
---|
[23209] | 146 | {foreach from=$params key=key item=value} |
---|
| 147 | "{$key}" : "{$value}", |
---|
| 148 | {/foreach} |
---|
| 149 | }, |
---|
| 150 | {/foreach} |
---|
| 151 | }; |
---|
[12617] | 152 | {/footer_script} |
---|
| 153 | |
---|
[23209] | 154 | |
---|
[24143] | 155 | {html_style} |
---|
[26554] | 156 | {foreach from=$fonts item=path key=font} |
---|
[26041] | 157 | @font-face { |
---|
| 158 | font-family: '{$font}'; |
---|
[26554] | 159 | src: url({$path}) format("truetype"); |
---|
[12617] | 160 | } |
---|
| 161 | {/foreach} |
---|
[24143] | 162 | {/html_style} |
---|
[12617] | 163 | |
---|
[23209] | 164 | |
---|
[12617] | 165 | <div class="titrePage"> |
---|
| 166 | <h2>Crypto Captcha</h2> |
---|
| 167 | </div> |
---|
| 168 | |
---|
| 169 | <form method="post" class="properties"> |
---|
| 170 | <fieldset> |
---|
[26041] | 171 | <legend>{'Configuration'|translate}</legend> |
---|
[12617] | 172 | |
---|
[15996] | 173 | <ul> |
---|
[12617] | 174 | <li> |
---|
[26041] | 175 | <b>{'Activate on'|translate}</b> |
---|
[23209] | 176 | <select name="activate_on[]" multiple> |
---|
[26041] | 177 | <option value="picture" {if $crypto.activate_on.picture}selected{/if}>{'Picture comments'|translate}</option> |
---|
| 178 | {if $loaded.category}<option value="category" {if $crypto.activate_on.category}selected{/if}>{'Album comments'|translate}</option>{/if} |
---|
| 179 | <option value="register" {if $crypto.activate_on.register}selected{/if}>{'Register form'|translate}</option> |
---|
| 180 | {if $loaded.contactform}<option value="contactform" {if $crypto.activate_on.contactform}selected{/if}>{'Contact form'|translate}</option>{/if} |
---|
| 181 | {if $loaded.guestbook}<option value="guestbook" {if $crypto.activate_on.guestbook}selected{/if}>{'Guestbook'|translate}</option>{/if} |
---|
[23209] | 182 | </select> |
---|
[15996] | 183 | </li> |
---|
| 184 | <li> |
---|
[26041] | 185 | <b>{'Comments action'|translate}</b> |
---|
| 186 | <label><input type="radio" name="comments_action" value="reject" {if $crypto.comments_action == 'reject'}checked="checked"{/if}> {'Reject'|translate}</label> |
---|
| 187 | <label><input type="radio" name="comments_action" value="moderate" {if $crypto.comments_action == 'moderate'}checked="checked"{/if}> {'Moderate'|translate}</label> |
---|
[12617] | 188 | </li> |
---|
| 189 | <li> |
---|
[26041] | 190 | <b>{'Captcha type'|translate}</b> |
---|
| 191 | <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|translate}</label> |
---|
| 192 | <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|translate}</label> |
---|
[12617] | 193 | </li> |
---|
| 194 | <!--<li> |
---|
[26041] | 195 | <b>{'Case sensitive'|translate}</b> |
---|
| 196 | <label><input type="radio" name="case_sensitive" value="false" {if $crypto.case_sensitive == 'false'}checked="checked"{/if}> {'No'|translate}</label> |
---|
| 197 | <label><input type="radio" name="case_sensitive" value="true" {if $crypto.case_sensitive == 'true'}checked="checked"{/if}> {'Yes'|translate}</label> |
---|
[12617] | 198 | </li>--> |
---|
| 199 | <li> |
---|
[26041] | 200 | <b>{'Code lenght'|translate}</b> |
---|
[14527] | 201 | <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label> |
---|
[12617] | 202 | </li> |
---|
| 203 | <li> |
---|
[26041] | 204 | <b>{'Width'|translate}</b> |
---|
| 205 | <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|translate} lenght×30</label> |
---|
[12617] | 206 | </li> |
---|
| 207 | <li> |
---|
[26041] | 208 | <b>{'Height'|translate}</b> |
---|
| 209 | <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|translate} lenght×12</label> |
---|
[12617] | 210 | </li> |
---|
| 211 | <li> |
---|
[26041] | 212 | <b>{'Button color'|translate}</b> |
---|
[26554] | 213 | <a class="button {if $crypto.button_color == 'dark'}selected{/if}" data-val="dark" data-input="button_color"><img src="{$CRYPTO_PATH}template/refresh_dark.png" alt="dark"></a> |
---|
| 214 | <a class="button {if $crypto.button_color == 'light'}selected{/if}" data-val="light" data-input="button_color"><img src="{$CRYPTO_PATH}template/refresh_light.png" alt="light"></a> |
---|
[23209] | 215 | <input type="hidden" name="button_color" value="{$crypto.button_color}"> |
---|
[19428] | 216 | </li> |
---|
| 217 | <li> |
---|
[26041] | 218 | <b>{'Captcha theme'|translate}</b> |
---|
[26554] | 219 | {foreach from=$PRESETS key=preset item=params} |
---|
| 220 | <a class="button {if $crypto.theme == $preset}selected{/if}" data-val="{$preset}" data-input="theme"><img src="{$CRYPTO_PATH}template/presets/{$preset}.png" alt="{$preset}"></a> |
---|
| 221 | {/foreach} |
---|
[23209] | 222 | <input type="hidden" name="theme" value="{$crypto.theme}"> |
---|
[26041] | 223 | <a class="customize">{'Customize'|translate}</a> |
---|
[12617] | 224 | </li> |
---|
| 225 | </ul> |
---|
| 226 | |
---|
| 227 | <fieldset {if $crypto.theme != 'custom'}style="display:none;"{/if} id="theming"> |
---|
[26041] | 228 | <legend>{'Customize'|translate}</legend> |
---|
[12617] | 229 | |
---|
| 230 | <ul> |
---|
| 231 | <li> |
---|
[26041] | 232 | <b>{'Perturbation'|translate}</b> |
---|
[26554] | 233 | <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 1</label> |
---|
[12617] | 234 | </li> |
---|
| 235 | <li> |
---|
[26554] | 236 | <b>{'Background'|translate}</b> |
---|
| 237 | <label><input type="radio" name="background" class="istheme preview" value="color" {if $crypto.background == 'color'}checked="checked"{/if}> {'Color'|translate}</label> |
---|
| 238 | <label><input type="radio" name="background" class="istheme preview" value="image" {if $crypto.background == 'image'}checked="checked"{/if}> {'Image'|translate}</label> |
---|
| 239 | </li> |
---|
| 240 | <li id="background-color" {if $crypto.background != 'color'}style="display:none;"{/if}> |
---|
[26041] | 241 | <b>{'Background color'|translate}</b> |
---|
[26554] | 242 | <label><input type="text" name="bg_color" value="{$crypto.bg_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
[26041] | 243 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
[12617] | 244 | </li> |
---|
[26554] | 245 | <li id="background-image" {if $crypto.background != 'image'}style="display:none;"{/if}> |
---|
| 246 | <b>{'Background image'|translate}</b> |
---|
| 247 | {foreach from=$backgrounds item=path key=background} |
---|
| 248 | <a class="button {if $crypto.bg_image == $background}selected{/if}" data-val="{$background}" data-input="bg_image"><img src="{$path}" alt="{$background}" style="width:120px;height:40px;"></a> |
---|
| 249 | {/foreach} |
---|
| 250 | <!-- <a class="button {if $crypto.bg_image == 'random'}selected{/if}" title="{'random'|translate}" data-val="random" data-input="bg_image"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> --> |
---|
| 251 | <input type="hidden" name="bg_image" value="{$crypto.bg_image}" class="istheme preview"> |
---|
| 252 | </li> |
---|
[12617] | 253 | <li> |
---|
[26041] | 254 | <b>{'Text color'|translate}</b> |
---|
[26554] | 255 | <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
[26041] | 256 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
[12617] | 257 | </li> |
---|
| 258 | <li> |
---|
[26041] | 259 | <b>{'Lines density'|translate}</b> |
---|
[26554] | 260 | <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 10</label> |
---|
[12617] | 261 | </li> |
---|
| 262 | <li> |
---|
[26041] | 263 | <b>{'Lines color'|translate}</b> |
---|
[26554] | 264 | <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
[26041] | 265 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
[12617] | 266 | </li> |
---|
| 267 | <li> |
---|
[26041] | 268 | <b>{'Noise level'|translate}</b> |
---|
[26554] | 269 | <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 10</label> |
---|
[12617] | 270 | </li> |
---|
| 271 | <li> |
---|
[26041] | 272 | <b>{'Noise color'|translate}</b> |
---|
[26554] | 273 | <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
[26041] | 274 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
[12617] | 275 | </li> |
---|
| 276 | <li> |
---|
[26041] | 277 | <b>{'Font'|translate}</b> |
---|
[26554] | 278 | {foreach from=$fonts item=path key=font} |
---|
| 279 | <label style="font-family:{$font};" title="{$font}"><input type="radio" name="ttf_file" value="{$font}" {if $crypto.ttf_file == $font}checked="checked"{/if} class="istheme preview"> {$font}</label> |
---|
| 280 | {/foreach} |
---|
[12617] | 281 | </li> |
---|
| 282 | </ul> |
---|
| 283 | |
---|
[26041] | 284 | {'Tip: type "random" on a color field to have a random color'|translate} |
---|
[12617] | 285 | </fieldset> |
---|
| 286 | |
---|
[19428] | 287 | <ul style="margin-top:30px;"> |
---|
| 288 | <li> |
---|
[26041] | 289 | <b>{'Preview'|translate}</b> |
---|
[19428] | 290 | <img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image"> |
---|
| 291 | <a href="#" onClick="return false;"><img id="reload" src="{$CRYPTO_PATH}template/refresh_{$crypto.button_color}.png"></a> |
---|
| 292 | </li> |
---|
| 293 | </ul> |
---|
| 294 | |
---|
[12617] | 295 | </fieldset> |
---|
[23209] | 296 | |
---|
[26041] | 297 | <p class="formButtons"><input class="submit" type="submit" value="{'Submit'|translate}" name="submit"></p> |
---|
[12617] | 298 | </form> |
---|
| 299 | |
---|
| 300 | <div style="text-align:right;"> |
---|
| 301 | All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> | |
---|
| 302 | Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a> |
---|
| 303 | </div> |
---|