PageSourceSearch

https://itm.co.za/DesktopModules/SunBlog/js/debug/jquery.plugins.js?cdv=4946

js itm.co.za collected 2026-10-05 02:57:19 UTC 6,276 bytes, 162 lines download raw bytes

1/*
2* JSON Plugin
3* @requires jQuery v1.2 or later
4*/
5(function($) {
6    m = {
7        '\b': '\\b',
8        '\t': '\\t',
9        '\n': '\\n',
10        '\f': '\\f',
11        '\r': '\\r',
12        '"': '\\"',
13        '\\': '\\\\'
14    },
15	$.toJSON = function(value, whitelist) {
16	    var a,          // The array holding the partial texts.
17			i,          // The loop counter.
18			k,          // The member key.
19			l,          // Length.
20			r = /["\\\x00-\x1f\x7f-\x9f]/g,
21			v;          // The member value.
22
23	    switch (typeof value) {
24	        case 'string':
25	            return r.test(value) ?
26				'"' + value.replace(r, function(a) {
27				    var c = m[a];
28				    if (c) {
29				        return c;
30				    }
31				    c = a.charCodeAt();
32				    return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
33				}) + '"' :
34				'"' + value + '"';
35
36	        case 'number':
37	            return isFinite(value) ? String(value) : 'null';
38
39	        case 'boolean':
40	        case 'null':
41	            return String(value);
42
43	        case 'object':
44	            if (!value) {
45	                return 'null';
46	            }
47	            if (typeof value.toJSON === 'function') {
48	                return $.toJSON(value.toJSON());
49	            }
50	            a = [];
51	            if (typeof value.length === 'number' &&
52					!(value.propertyIsEnumerable('length'))) {
53	                l = value.length;
54	                for (i = 0; i < l; i += 1) {
55	                    a.push($.toJSON(value[i], whitelist) || 'null');
56	                }
57	                return '[' + a.join(',') + ']';
58	            }
59	            if (whitelist) {
60	                l = whitelist.length;
61	                for (i = 0; i < l; i += 1) {
62	                    k = whitelist[i];
63	                    if (typeof k === 'string') {
64	                        v = $.toJSON(value[k], whitelist);
65	                        if (v) {
66	                            a.push($.toJSON(k) + ':' + v);
67	                        }
68	                    }
69	                }
70	            } else {
71	                for (k in value) {
72	                    if (typeof k === 'string') {
73	                        v = $.toJSON(value[k], whitelist);
74	                        if (v) {
75	                            a.push($.toJSON(k) + ':' + v);
76	                        }
77	                    }
78	                }
79	            }
80	            return '{' + a.join(',') + '}';
81	    }
82	};
83
84})(jQuery);
85/*
86* Rater Plugin 1.1
87* Copyright 2008 Jarrett Vance http://jvance.com
88* @requires jQuery v1.2 or later
89*/
90(function($) {
91    $.fn.rater = function(options) {
92        var opts = $.extend({}, $.fn.rater.defaults, options);
93        return this.each(function() {
94            var $this = $(this);
95            var $on = $this.find('.ui-rater-starsOn');
96            var $off = $this.find('.ui-rater-starsOff');
97            if (opts.size == undefined) opts.size = $off.height();
98            if (opts.rating == undefined) opts.rating = $on.width() / opts.size;
99            if (opts.id == undefined) opts.id = $this.attr('id');
100
101            $off.mousemove(function(e) {
102                var left = e.clientX - $off.offset().left;
103                var width = $off.width() - ($off.width() - left);
104                width = Math.min(Math.ceil(width / (opts.size / opts.step)) * opts.size / opts.step, opts.size * opts.ratings.length)
105                $on.width(width);
106                var r = Math.round($on.width() / $off.width() * (opts.ratings.length * opts.step)) / opts.step;
107                $this.attr('title', opts.ratings[r - 1] == undefined ? r : opts.ratings[r - 1]);
108            }).hover(function(e) { $on.addClass('ui-rater-starsHover'); }, function(e) {
109                $on.removeClass('ui-rater-starsHover'); $on.width(opts.rating * opts.size);
110            }).click(function(e) {
111                var r = Math.round($on.width() / $off.width() * (opts.ratings.length * opts.step)) / opts.step;
112                $.fn.rater.rate($this, opts, r);
113            }).css('cursor', 'pointer'); $on.css('cursor', 'pointer');
114        });
115    };
116
117    $.fn.rater.defaults = {
118        postHref: location.href,
119        ratings: ['Bad', 'Boring', 'Average', 'Good', 'Great'],
120        step: 1,
121        beforeSendCallback: null
122    };
123
124    $.fn.rater.rate = function($this, opts, rating) {
125        var $on = $this.find('.ui-rater-starsOn');
126        var $off = $this.find('.ui-rater-starsOff');
127        $off.fadeTo(600, 0.4, function () {
128            var dto = {};
129            dto.id = opts.id;
130            dto.rating = rating;
131            $.ajax({
132                url: opts.postHref,
133                type: "POST",
134                data: dto, //'id=' + opts.id + '&rating=' + rating,
135                beforeSend: opts.beforeSendCallback,
136                success: function (data) {
137                    if (data == "HASRATED") {
138                        alert("You already rated this post");
139                    } else {
140                        opts.rating = parseFloat(data);
141                        $off.unbind('click').unbind('mousemove').unbind('mouseenter').unbind('mouseleave');
142                        $off.css('cursor', 'default'); $on.css('cursor', 'default');
143                        $off.fadeTo(600, 0.1, function () {
144                            $on.removeClass('ui-rater-starsHover').width(opts.rating * opts.size);
145                            var $count = $this.find('.ui-rater-rateCount');
146                            $count.text(parseInt($count.text()) + 1);
147                            $this.find('.ui-rater-rating').text(opts.rating.toFixed(1));
148                            $off.fadeTo(500, 1);
149                            $this.attr('title', 'Your rating: ' + rating.toFixed(1));
150                        });
151
152                        alert("Your rating has been registered. Thank you!");
153                    }
154                },
155                error: function (xhr, status, error) {
156                    alert("An error occured while registering your rating. Please try again");
157                    $off.fadeTo(2200, 1);
158                }
159            });
160        });
161    };
162})(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.