1 | /* |
---|
2 | * SlideEasyCaptcha - v1.0 - 01-01-2014 |
---|
3 | * plugin for Slide and EasyCaptcha |
---|
4 | * Original by mistic100 for EasyCaptcha : http://fr.piwigo.org/ext/extension_view.php?eid=591 |
---|
5 | * Modified by Miklfe : http://piwitheme.fr/ |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | function _ECaptcha(){ |
---|
10 | var $layerShow = $('body').data('layerShow'); |
---|
11 | if($('#the_page', $layerShow).hasClass('EC_drag')) { |
---|
12 | $.getScript('./plugins/EasyCaptcha/template/jquery.events/jquery.event.drag-2.2.js'); |
---|
13 | $.getScript('./plugins/EasyCaptcha/template/jquery.events/jquery.event.drop-2.2.js',function(){ |
---|
14 | $.getScript('./plugins/EasyCaptcha/template/drag.js'); |
---|
15 | }); |
---|
16 | var $ele = $('#the_page', $layerShow), |
---|
17 | $EC_opt = $ele.data('slideec'), |
---|
18 | $bd1 = $EC_opt.bd1, |
---|
19 | $bd2 = $EC_opt.bd2, |
---|
20 | $bg1 = $EC_opt.bg1, |
---|
21 | $bg2 = $EC_opt.bg2, |
---|
22 | $size = $EC_opt.size, |
---|
23 | $obj = $EC_opt.obj, |
---|
24 | $nb = $EC_opt.nb, |
---|
25 | $txt = $EC_opt.txt, |
---|
26 | $sel = $EC_opt.sel, |
---|
27 | $marle = (15+($size+5))*$nb, |
---|
28 | $ECcss = '#easycaptcha, #easycaptcha_noscript{display: inline-block; position:relative; padding:10px; border-radius:8px; background:' + $bg1 + '; background:-webkit-linear-gradient(top, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-moz-linear-gradient(top, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-ms-linear-gradient(top, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-o-linear-gradient(top, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%);background:linear-gradient(to bottom, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%);color: ' + $txt +' } #easycaptcha .drag_item{position:absolute; top:15px; width:' + $size + 'px; height:' + $size + 'px; border-radius:5px; border:1px solid ' + $bd1 + '; background:' + $obj + '; z-index:10; cursor:move} #easycaptcha .drag_item.active {z-index:100; opacity:0.75;} #easycaptcha .drag_item img{width' + $size + 'px; height:' + $size + 'px; border-radius: 5px;} #easycaptcha .drop_zone{padding:5px; width:' + $size + 'px; height:' + $size + 'px; margin-left:' + $marle + 'px; line-height:' + $size + 'px; background:' + $bg1 + '; background:-webkit-linear-gradient(bottom, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-moz-linear-gradient(bottom, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-ms-linear-gradient(bottom, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:-o-linear-gradient(bottom, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); background:linear-gradient(to top, ' + $bg1 + ' 0%, ' + $bg2 + ' 100%); border:1px dotted ' + $bd2 + '; border-radius:5px; text-align:center; text-transform:uppercase; color:' + $txt + ';} #easycaptcha .drop_zone.active{background:' + $sel + ';} #easycaptcha .drop_zone.valid{background:' + $sel + '; box-shadow:0 0 0 2px ' + $sel + ';}'; |
---|
29 | |
---|
30 | |
---|
31 | $("<style />", { |
---|
32 | type: "text/css", |
---|
33 | }).append($ECcss).appendTo('head'); |
---|
34 | |
---|
35 | } |
---|
36 | else { |
---|
37 | var $ele = $('#the_page', $layerShow), |
---|
38 | $EC_opt = $ele.data('slideec'), |
---|
39 | $size = $EC_opt.tictacsize, |
---|
40 | $i = $('#commentAdd').data('now'), |
---|
41 | $3size = $size/3, |
---|
42 | $ECcss = '#easycaptcha table{background:url("./plugins/EasyCaptcha/tictac/gen.php?t=' + $i + '") no-repeat; width:' + $size + 'px; height:' + $size + 'px; border-collapse:collapse; display:inline-block; margin:0} #easycaptcha td{border:none; padding:0} #easycaptcha label{display: block; width:' + $3size + 'px; height:' + $3size + 'px; cursor:url("./plugins/EasyCaptcha/tictac/gen.php?cross=96") 16 16, pointer;} #easycaptcha input{display: none} #easycaptcha label.selected{background: url("./plugins/EasyCaptcha/tictac/gen.php?cross=' + $size + '") no-repeat}'; |
---|
43 | |
---|
44 | $("<style />", { |
---|
45 | type: "text/css", |
---|
46 | }).append($ECcss).appendTo('head'); |
---|
47 | |
---|
48 | $('#easycaptcha input').on('change', function() { |
---|
49 | $('#easycaptcha label').removeClass('selected'); |
---|
50 | $(this).parent('label').addClass('selected'); |
---|
51 | }) |
---|
52 | |
---|
53 | } |
---|
54 | } |
---|