source: extensions/Slide/js/plugin/SlideEasyCaptcha.js @ 26889

Last change on this file since 26889 was 26889, checked in by Miklfe, 10 years ago
File size: 3.9 KB
Line 
1/*
2 * SlideGThumb - 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
10/*function _ECaptcha(){
11var $layerShow  = $('body').data('layerShow'),
12        $ele                    = $('#the_page', $layerShow),
13                $EC_opt                 = $ele.data('slideec'),
14                $bd1                    = $EC_opt.activate_on.challenge;
15
16                console.log($bd1);
17
18                       
19}*/
20
21
22
23function _ECaptcha(){
24        var $layerShow  = $('body').data('layerShow');
25if($('#the_page', $layerShow).hasClass('EC_drag')) {
26                $.getScript('./plugins/EasyCaptcha/template/jquery.events/jquery.event.drag-2.2.js');
27                $.getScript('./plugins/EasyCaptcha/template/jquery.events/jquery.event.drop-2.2.js',function(){
28                        $.getScript('./plugins/EasyCaptcha/template/drag.js');
29                });
30                var     $ele                    = $('#the_page', $layerShow),
31                        $EC_opt                 = $ele.data('slideec'),
32                        $bd1                    = $EC_opt.bd1,
33                        $bd2                    = $EC_opt.bd2,
34                        $bg1                    = $EC_opt.bg1,
35                        $bg2                    = $EC_opt.bg2,
36                        $size                   = $EC_opt.size,
37                        $obj                    = $EC_opt.obj,
38                        $nb                             = $EC_opt.nb,
39                        $txt                    = $EC_opt.txt,
40                        $sel                    = $EC_opt.sel,
41                        $marle                  = (15+($size+5))*$nb,
42                        $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 + ';}';
43
44                       
45                        $("<style />", {
46                                type: "text/css",
47                        }).append($ECcss).appendTo('head');
48
49        } 
50        else {
51                var     $ele                    = $('#the_page', $layerShow),
52                        $EC_opt                 = $ele.data('slideec'),
53                        $size                   = $EC_opt.tictacsize,
54                        $i                              = $('#commentAdd').data('now'),
55                        $3size                  = $size/3,
56                        $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}';
57                               
58                $("<style />", {
59                        type: "text/css",
60                }).append($ECcss).appendTo('head');
61               
62                $('#easycaptcha input').on('change', function() {
63                        $('#easycaptcha label').removeClass('selected');
64                        $(this).parent('label').addClass('selected');
65                })     
66
67        }
68}
Note: See TracBrowser for help on using the repository browser.