PageSourceSearch

https://vagur.fo/ease/3rdparty/js/Qodio/q.checkator.jquery.js?v=3.28.6.13-3_0

js vagur.fo collected 2026-10-02 23:09:42 UTC 4,053 bytes, 131 lines download raw bytes

1/*
2 Checkator jQuery Plugin
3 A plugin for radio and checkbox elements
4 version 1.2, May 16th, 2015
5 by Ingi á Steinamørk
6
7 The MIT License (MIT)
8
9 Copyright (c) 2013 Ingi á Steinamørk
10
11 Permission is hereby granted, free of charge, to any person obtaining a copy of
12 this software and associated documentation files (the "Software"), to deal in
13 the Software without restriction, including without limitation the rights to
14 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15 the Software, and to permit persons to whom the Software is furnished to do so,
16 subject to the following conditions:
17
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27*/
28
29(function($) {
30	$.checkator = function (element, options) {
31		var defaults = {
32			prefix: 'checkator_'
33		};
34	
35		var $element = $(element);
36		var plugin = this;
37		var type = $element.attr('type');
38		var checked = $element.is(':checked');
39		var $wrapper = null;
40		var $new_element = null;
41		plugin.settings = {};
42
43		
44		
45		// INITIALIZE PLUGIN
46		plugin.init = function () {
47			plugin.settings = $.extend({}, defaults, options);
48
49			$wrapper = $(document.createElement('div'));
50			$wrapper.addClass(plugin.settings.prefix + 'holder ' + type);
51			$element.before($wrapper);
52			$wrapper.append($element);
53			$new_element = $(document.createElement('div'));
54			if ($element.attr('id') !== undefined) {
55				$new_element.attr('id', plugin.settings.prefix + $element.attr('id'));
56			}
57			if ($element.css('position') === 'relative') {
58				if ($element.css('top') !== 'auto') {
59					$new_element.css({
60						'top': $element.css('top'),
61						'bottom': '-' + $element.css('top')
62					});
63				}	
64				if ($element.css('left') !== 'auto') {
65					$new_element.css({
66						'left': $element.css('left'),
67						'right': '-' + $element.css('left')
68					});
69				}	
70			}
71			$new_element.addClass(plugin.settings.prefix + 'element ' + type + ' ' + (checked ? 'checked ' : ''));
72
73			$wrapper.css({
74				width: $element.outerWidth() + 'px',
75				height: $element.outerHeight() + 'px',
76				'margin-top': $element.css('margin-top'),
77				'margin-right': $element.css('margin-right'),
78				'margin-bottom': $element.css('margin-bottom'),
79				'margin-left': $element.css('margin-left'),
80				'float': $element.css('float'),
81				'display': $element.css('display') === 'inline' ? 'inline-block' : $element.css('display')
82			});
83			$element.css({
84				opacity: 0,
85				margin: 0
86			});
87			
88			$element.addClass(plugin.settings.prefix + 'source');
89			$element.after($new_element);
90
91		};
92
93
94		// REMOVE PLUGIN AND REVERT SELECT ELEMENT TO ORIGINAL STATE
95		plugin.destroy = function () {
96			$new_element.remove();
97			$.removeData($element[0], 'checkator');
98			$element.css({ 
99				opacity: '',
100				margin: '' 
101			});
102			$element.removeClass(plugin.settings.prefix + 'source');
103			$element.unwrap();
104		};
105		
106
107		// Initialize plugin
108		plugin.init();
109	};
110	
111	$.fn.checkator = function(options) {
112		options = options !== undefined ? options : {};
113		return this.each(function () {
114			if (typeof(options) === 'object') {
115				if (undefined === $(this).data('checkator')) {
116					var plugin = new $.checkator(this, options);
117					$(this).data('checkator', plugin);
118				}
119			} else if ($(this).data('checkator')[options]) {
120				$(this).data('checkator')[options].apply(this, Array.prototype.slice.call(arguments, 1));
121			} else {
122				$.error('Method ' + options + ' does not exist in $.checkator');
123			}
124		});
125	};
126
127}(jQuery));
128
129$(function () {
130	$('.checkator').checkator();
131});

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.