PageSourceSearch

https://2event.com/assets/3dfb5f41/yii.captcha.js

js 2event.com collected 2026-09-24 09:46:57 UTC 2,057 bytes, 69 lines download raw bytes

1/**
2 * Yii Captcha widget.
3 *
4 * This is the JavaScript widget used by the yii\captcha\Captcha widget.
5 *
6 * @link https://www.yiiframework.com/
7 * @copyright Copyright (c) 2008 Yii Software LLC
8 * @license https://www.yiiframework.com/license/
9 * @author Qiang Xue <[email protected]>
10 * @since 2.0
11 */
12(function ($) {
13    $.fn.yiiCaptcha = function (method) {
14        if (methods[method]) {
15            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
16        } else if (typeof method === 'object' || !method) {
17            return methods.init.apply(this, arguments);
18        } else {
19            $.error('Method ' + method + ' does not exist in jQuery.yiiCaptcha');
20            return false;
21        }
22    };
23
24    var defaults = {
25        refreshUrl: undefined,
26        hashKey: undefined
27    };
28
29    var methods = {
30        init: function (options) {
31            return this.each(function () {
32                var $e = $(this);
33                var settings = $.extend({}, defaults, options || {});
34                $e.data('yiiCaptcha', {
35                    settings: settings
36                });
37
38                $e.on('click.yiiCaptcha', function () {
39                    methods.refresh.apply($e);
40                    return false;
41                });
42            });
43        },
44
45        refresh: function () {
46            var $e = this,
47                settings = this.data('yiiCaptcha').settings;
48            $.ajax({
49                url: $e.data('yiiCaptcha').settings.refreshUrl,
50                dataType: 'json',
51                cache: false,
52                success: function (data) {
53                    $e.attr('src', data.url);
54                    $('body').data(settings.hashKey, [data.hash1, data.hash2]);
55                }
56            });
57        },
58
59        destroy: function () {
60            this.off('.yiiCaptcha');
61            this.removeData('yiiCaptcha');
62            return this;
63        },
64
65        data: function () {
66            return this.data('yiiCaptcha');
67        }
68    };
69})(window.jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.