PageSourceSearch

https://www.dukesynthesis.com/Ext/Resources?a=bvYs0aOEOUIk3qjg__c8…74LUEPQZtTwomg0BGmq_e3L2aQaMCi_UPplnDWr1Mo,

js dukesynthesis.com collected 2026-09-28 01:07:50 UTC 9,312 bytes, 373 lines download raw bytes

1
2/* Base */
3if (!window.WS) window.WS = {};
4if (!WS.Namespace)
5{
6    WS.Namespace = {
7        Create: function (name, value)
8        {
9            var root = window;
10            var parts = name.split(".");
11            var i = 0;
12            for (i = 0; i < parts.length - 1; i++)
13            {
14                if (!root[parts[i]]) root[parts[i]] = {};
15                root = root[parts[i]];
16            }
17
18            if (!root[parts[i]]) root[parts[i]] = value;
19        }
20    };
21}
22
23/**
24@class EventObject
25@namespace WS
26@constructor 
27@param {Array} Events 
28**/
29WS.Namespace.Create("WS.EventObject", (function ()
30{
31    // Constructor(s)
32    var _class = function (events)
33    {
34        if (!(events instanceof Array)) throw "Invalid parameter : events must be an array.";
35        this.events = events;
36        this.handlers = [];
37        for (var i = 0; i < events.length; i++) this.handlers.push([]);
38    };
39
40    // Public Methods
41    (function (methods)
42    {
43        /**
44        RegisterEvent, let you listen to an event and attach handler to it.
45        
46        @method RegisterEvent
47        @param {String} Name
48        @param {Function} Handler
49        @param {Object} Context
50        **/
51        methods.RegisterEvent = function (name, handler, context)
52        {
53            if (!name) return;
54            if (!handler) return;
55
56            name = name.toLowerCase();
57            context = context || window;
58
59            var idx = this.events.indexOf(name);
60            if (idx != -1) this.handlers[idx].push({ handler: handler, context: context });
61        };
62
63        /**
64        UnregisterEvent, let you cancel an event listener.
65        
66        @method UnregisterEvent
67        @param {String} Name
68        @param {Function} [Handler]
69        @param {Object} [Context]
70        **/
71        methods.UnregisterEvent = function (name, handler, context)
72        {
73            if (!name) return;
74
75            name = name.toLowerCase();
76            context = context || window;
77
78            var idx = this.events.indexOf(name);
79            if (idx != -1)
80            {
81                if (handler)
82                {
83                    for (var i = 0; i < this.handlers[idx].length; i++)
84                    {
85                        if (this.handlers[idx][i].handler === handler && this.handlers[idx][i].context === context)
86                        {
87                            this.handlers[idx].splice(i, 1);
88                            i = this.handlers[idx].length;
89                        }
90                    }
91                }
92
93                else
94                {
95                    this.handlers[idx].splice(0, this.handlers[idx].length);
96                }
97            }
98        };
99
100        /**
101        Raise an Event, can be catched when RegisterEvent is implemented.
102
103        @method RaiseEvent
104        @param {String} Name
105        @param {Object} [Arguments]
106        **/
107        methods.RaiseEvent = function (name)
108        {
109            var idx = this.events.indexOf(name);
110            var args = Array.prototype.slice.call(arguments, 0);
111            args.splice(0, 1);
112            var result = [];
113            if (idx != -1) { for (var i = 0; i < this.handlers[idx].length; i++) result.push(this.handlers[idx][i].handler.apply(this.handlers[idx][i].context, args)); }
114            return result;
115        };
116
117        /**
118        Add a new event type.
119
120        @method AddEvent
121        @param {String} Name
122        **/
123        methods.AddEvent = function (name)
124        {
125            if (!name) return;
126
127            name = name.toLowerCase();
128
129            var idx = this.events.indexOf(name);
130            if (idx == -1)
131            {
132                this.events.push(name);
133                this.handlers.push([]);
134            }
135        };
136    })(_class.prototype);
137
138
139    return _class;
140})());
141
142/**
143@class Exts
144@namespace WS
145@static
146**/
147WS.Namespace.Create("WS.Exts", {
148
149    /**
150    Method Bindings
151
152    @method BindMethod
153    @param {Function} Method Func Ref.
154    @param {Object} Context Element (this)
155    **/
156    BindMethod: function (method, context)
157    {
158        return function () { method.apply(context, arguments); };
159    },
160
161    /**
162    Inherits from Class
163
164    @method Inherits
165    @param {Object} Child Object to Bind Inherits
166    @param {Object} Base Object from which Child Inherits
167    **/
168    Inherits: function (child, base)
169    {
170        child.prototype = Object.create(base.prototype);
171    },
172
173    /**
174    Create Class
175
176    @method CreateClass
177    @param {Function} Constructor
178    @param {Object List(String,Function)} [Methods] ListOf MethodName With theirs Function
179    @param {Function} [BaseClass]
180    **/
181    CreateClass: function (constructor, methods, baseClass)
182    {
183        if (!(typeof constructor === 'function')) throw "Parameter 'constructor' must be a function.";
184
185        var _class = constructor;
186        if (typeof baseClass === 'function') WS.Exts.Inherits(_class, baseClass);
187
188        if (typeof methods === 'object')
189        {
190            for (var name in methods)
191            {
192                if (methods[name] instanceof Function) _class.prototype[name] = methods[name];
193            }
194        }
195
196        return _class;
197    }
198});
199
200//--------
201// String
202//--------
203
204if (!String.prototype.startsWith) {
205    /**
206    Check if string starts with input string
207    
208    @method startsWith
209    @param {String} Input 
210     **/
211    String.prototype.startsWith = function (str) {
212        return (this.match("^" + str) == str)
213    }
214}
215
216if (!String.prototype.endsWith) {
217    /**
218    Check if string ends with input string
219    
220    @method endsWith
221    @param {String} Input 
222     **/
223    String.prototype.endsWith = function (str) {
224        return (this.match(str + "$") == str)
225    }
226}
227
228/**
229Check if string contains input string
230
231@method contains
232@param {String} Input 
233 **/
234String.prototype.contains = function (str)
235{
236    return this.indexOf(str) != -1;
237};
238
239/**
240@method getKeyValue
241@param {String} Splitter 
242 **/
243String.prototype.getKeyValue = function (splitter)
244{
245    var Params = {};
246    try
247    {
248        this.split(splitter).forEach(function (item)
249        {
250            var items = item.split("=");
251            var length = items.length;
252            var Values = "";
253            for (var i = 1; i <= length - 1 ; i++)
254            {
255                if (Values) Values += "=";
256                Values += items[i];
257            }
258
259            Params[item.split("=")[0].trim()] = Values;
260        });
261    }
262    catch (ex) { Params = null; }
263
264
265    return Params;
266}
267
268String.prototype.EscapeQuotes = function () {
269    return this.replace(/[\\"']/g, '\\$&');
270};
271
272//--------
273// Array
274//--------
275
276/**
277Swap elements from Source and Destination
278
279@method swapItems
280@param {Integer} SourceIndex
281@param {Integer} DestinationIndex
282 **/
283Array.prototype.swapItems = function (a, b)
284{
285    this[a] = this.splice(b, 1, this[a])[0];
286
287
288    return this;
289}
290
291/**
292Remove item from array
293
294@method contains
295@param {Object} Content 
296 **/
297Array.prototype.remove = function (content)
298{
299    var Idx = this.indexOf(content);
300    if (Idx != -1) this.splice(Idx, 1);
301};
302
303/**
304Check if Array contains Object
305
306@method contains
307@param {Object} Content 
308 **/
309Array.prototype.contains = function (content)
310{
311    return this.indexOf(content) != -1;
312};
313
314/**
315Move item from source to destination and ajust
316all others items to correct index
317
318@method moveItem
319@param {Integer} SourceIndex
320@param {Integer} DestinationIndex
321 **/
322Array.prototype.moveItem = function (a, b)
323{
324    var current = this[a];
325    this.splice(a, 1);
326    return this.splice(b, 0, current);
327}
328
329//----------
330// Number
331//----------
332Number.round = function (value, nbdecimals) {
333    if (value === undefined) throw "value cannot be null";
334    if (typeof value !== "number" && typeof value !== "string") throw "value must string or a numeric";
335    if (nbdecimals == null || typeof nbdecimals !== "number") throw "nbdecimals cannot be null";
336
337    if (typeof value == "string") { value = value.replace(",", "."); }
338    value = parseFloat(value).toFixed(nbdecimals);
339
340    return Number((Math.round(value + "e" + nbdecimals) + "e-" + nbdecimals));
341}
342
343var GetQueryString = function (location) {
344    var Params = {};
345    try {
346        location.search.substr(1).split("&").forEach(function (item) { Params[item.split("=")[0]] = item.split("=")[1] });
347    }
348    catch (ex) { }
349
350
351    return Params;
352};
353
354var ScrollToElement = function (element) {
355
356    if (element.length == 0) return;
357
358    var newScrollY = element.offset().top;
359
360    if (WS.IsMobile) {
361        if ($("#Menu").css('position') == 'fixed') newScrollY -= $(".wsMobileTopBar").height();
362    }
363    else {
364        var menu = WS.Editor.Menu.GetInstance();
365        if (menu) menu.ReassignActivePage();
366        if ($("#HeaderWrapper").css('position') == 'fixed') newScrollY -= $("#HeaderWrapper").height();
367    }
368
369    $("html,body").velocity('scroll', {
370        duration: 500,
371        offset: newScrollY
372    });
373};

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.