PageSourceSearch

https://soporte.unae.edu.ec/static/js/jquery.vswitch.js?v=1.7.0

js unae.edu.ec collected 2026-10-02 04:20:36 UTC 3,172 bytes, 97 lines download raw bytes

1/*
2 * Project: vSwitch
3 * Description: Checkbox switch jQuery plug-in
4 * Author: https://github.com/Wancieho
5 * License: MIT
6 * Version: 0.0.2
7 * Dependancies: jquery-1.*
8 * Date: 24/06/2016
9 */
10;
11(function ($) {
12    'use strict';
13
14    var pluginName = 'vSwitch';
15    var defaults = {
16        theme: '',
17        size: ''
18    };
19
20    function vSwitch(checkbox, options) {
21        this.checkbox = checkbox;
22        this.settings = $.extend({}, defaults, options);
23        this.isOn = null;
24
25        this.privateMethodScopeAssignment();
26    }
27
28    $.extend(vSwitch.prototype, {
29        privateMethodScopeAssignment: function () {
30            create.apply(this);
31            currentCheckboxState.apply(this);
32            events.apply(this);
33        }
34    });
35
36    function create() {
37        if ($(this.checkbox).attr('data-toggle')==='tooltip'){
38            if ($(this.checkbox).attr('data-original-title')){
39                if ($(this.checkbox).attr('data-original-title').length > 0) {
40                    $(this.checkbox).wrap('<div class="vSwitch">').parent().append('<div class="switch" data-toggle="tooltip" data-placement="top" data-original-title="' + $(this.checkbox).attr('data-original-title') + '" title="' + $(this.checkbox).attr('data-original-title') + '"><div class="button">');
41                }
42            }
43            if ($(this.checkbox).attr('title')){
44                if ($(this.checkbox).attr('title').length > 0){
45                    $(this.checkbox).wrap('<div class="vSwitch">').parent().append('<div class="switch" data-toggle="tooltip" data-placement="top" data-original-title="'+$(this.checkbox).attr('title')+'" title="'+$(this.checkbox).attr('title')+'"><div class="button">');
46                }
47            }
48        } else {
49            $(this.checkbox).wrap('<div class="vSwitch">').parent().append('<div class="switch"><div class="button">');
50        }
51
52        var wrapper = $(this.checkbox).parent();
53
54        if (this.settings.theme !== '') {
55            wrapper.addClass(this.settings.theme);
56        }
57
58        if (this.settings.size !== '') {
59            $(this.checkbox).parent().addClass(this.settings.size);
60        }
61
62        $(this.checkbox).hide();
63    }
64
65    function currentCheckboxState() {
66        if ($(this.checkbox).prop('checked')) {
67            this.isOn = true;
68            $(this.checkbox).parent().addClass('on');
69            $(this.checkbox).attr({'checked': 'checked'});
70
71        } else {
72            this.isOn = false;
73            $(this.checkbox).parent().removeClass('on');
74            $(this.checkbox).removeAttr('checked');
75        }
76    }
77
78    function events() {
79        var scope = this;
80
81        $(this.checkbox).on('click', function () {
82            currentCheckboxState.apply(scope);
83        });
84
85        $(this.checkbox).siblings('.switch').on('click', function () {
86            $(scope.checkbox).trigger('click');
87        });
88    }
89
90    $.fn[pluginName] = function (options) {
91        return this.each(function () {
92            if (!$.data(this, 'plugin_' + pluginName)) {
93                $.data(this, 'plugin_' + pluginName, new vSwitch(this, options));
94            }
95        });
96    };
97})(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.