PageSourceSearch

https://www.redbeartrading.com/ccp8/media/scripts/common.js

js redbeartrading.com collected 2026-10-08 14:04:49 UTC 11,255 bytes, 438 lines download raw bytes

1// +------------------------------------------------------------------+
2// | Global Variables                                                 |
3// +------------------------------------------------------------------+
4
5DelayTimer        = 0;
6DelayFader        = 300;
7DelayDestroyFader = 3000;
8AjaxDelay         = 1000;
9QtipDelay         = 500;
10
11// +------------------------------------------------------------------+
12// | Document Ready Controls                                          |
13// +------------------------------------------------------------------+
14
15jQuery(document).ready(function(){
16
17commonDoDocReady();
18
19}); // End of function.
20
21// +------------------------------------------------------------------+
22// | Document Ready Function                                          |
23// +------------------------------------------------------------------+
24
25function commonDoDocReady() {
26
27// +--
28// | Disable Double Submits
29// +--
30
31jQuery('input:submit').click(function(){
32
33     if (jQuery(this).prop('value') == 'Cancel') {return true;}
34
35     if (jQuery(this).hasClass('disabled')) {return false;}
36
37     jQuery(this).addClass('disabled');
38
39     return true;
40
41});
42 
43jQuery('input:image').click(function(){
44
45     if (jQuery(this).hasClass('disabled')) {return false;}
46
47     jQuery(this).addClass('disabled');
48
49     return true;
50
51});
52
53// +--
54// | Handle External Links
55// +--
56
57jQuery('a[rel=\'external\']').prop('target', '_blank');
58
59jQuery('a[rel=\'publisher\']').prop('target', '_blank');
60
61// +--
62// | Handle External Popups
63// +--
64
65jQuery('a[rel^=\'popup\']').click(function(){
66
67     var screenWidth      = screen.availWidth;
68     var screenHeight     = screen.availHeight;
69     var linkDest         = jQuery(this).prop('href');
70     var relIndex         = jQuery(this).prop('rel');
71     var relSplit         = relIndex.split("|");
72     var popupWidth       = relSplit[1];
73     var popupHeight      = relSplit[2];
74
75     if (relSplit[1] > screenWidth)  {popupWidth  = screenWidth - 10;}
76     if (relSplit[2] > screenHeight) {popupHeight = screenHeight - 40;}
77
78     var screenX = (screenWidth - popupWidth) * .5;
79     var screenY = (screenHeight - popupHeight) * .5;
80
81     if (screenX < 0) {screenX = 0;}
82     if (screenY < 0) {screenY = 0;}
83
84     var windowAttributes  = '';
85
86     windowAttributes      = 'width=' + popupWidth + ',height=' + popupHeight + ',left=' + screenX;
87     windowAttributes     += ',top=' + screenY + ',scrX=' + screenX + ',screenY=' + screenY;
88     windowAttributes     += ',location=1,resizable=' + relSplit[3] + ',scrollbars=' + relSplit[4];
89
90     window.open(linkDest, 'popupWindow', windowAttributes);
91
92     return false;
93
94});
95
96} // End of function.
97
98// +------------------------------------------------------------------+
99// | Window Unload Controls                                           |
100// +------------------------------------------------------------------+
101
102jQuery(window).unload(function() {
103
104// +--
105// | Reset Disabled Double Submits
106// +--
107
108jQuery('input:submit').removeClass('disabled');
109
110jQuery('input:image').removeClass('disabled');
111
112});
113
114// +------------------------------------------------------------------+
115// | Function: wysiwygLoad                                            |
116// +------------------------------------------------------------------+
117
118function wysiwygLoad(divid) {
119
120// +--
121// | Check to see if the div is defined. If not, exit.
122// +--
123
124if (!divid) {return false;}
125
126if (jQuery('#' + divid).length == 0) {return false;}
127
128// +--
129// | Hide the editor link.
130// +--
131
132jQuery('#' + divid + '--wysiwyglink').hide('fade', DelayFader);
133
134setTimeout(function() {
135
136     jQuery('#' + divid + '--wysiwyglink').css({'display': 'none'});
137
138}, DelayFader);
139
140// +--
141// | Launch the editor.
142// +--
143
144jQuery('#' + divid).cleditor({
145
146     width:        '90%',
147     height:       375,
148     controls:     'bold italic underline strikethrough | style color removeformat | bullets numbering | ' + 
149                   'outdent indent | alignleft center alignright justify | undo redo | rule image ' +
150                   'link unlink | source',
151     styles:       [['Paragraph', '<p>'], ['Header 1', '<h1>'], ['Header 2', '<h2>'], ['Header 3', '<h3>']],
152     docType:      '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
153     bodyStyle:    'margin:4px; font: 12px Arial,Verdana; cursor:text'
154
155});
156
157jQuery('#' + divid).cleditor()[0].focus();
158
159// +--
160// | Return false.
161// +--
162
163return false;
164
165} // End of function.
166
167// +------------------------------------------------------------------+
168// | Function: idShowHide                                             |
169// +------------------------------------------------------------------+
170
171function idShowHide(divid) {
172
173// +--
174// | Check to see if the div is defined. If not, exit.
175// +--
176
177if (!divid) {return false;}
178
179if (jQuery('#' + divid).length == 0) {return false;}
180
181// +--
182// | Hide the item, if it's visible.
183// +--
184
185if (jQuery('#' + divid).css('display') != 'none') {
186
187     jQuery('#' + divid).hide('fade', DelayFader);
188
189     setTimeout(function() {
190
191          jQuery('#' + divid).css({'display': 'none'});
192
193     }, DelayFader);
194
195// +--
196// | Show the item, if it's not visible.
197// +--
198
199} else {
200
201     jQuery('#' + divid).show('fade', DelayFader);
202
203     setTimeout(function() {
204
205          jQuery('#' + divid).css({'display': 'block'});
206
207     }, DelayFader);
208
209} // End of if statement.
210
211// +--
212// | Return false.
213// +--
214
215return false;
216
217} // End of function.
218
219// +------------------------------------------------------------------+
220// | Function: idDestroyFade                                          |
221// +------------------------------------------------------------------+
222
223function idDestroyFade(divid) {
224
225// +--
226// | Check to see if the div is defined. If not, exit.
227// +--
228
229if (!divid) {return false;}
230
231if (jQuery('#' + divid).length == 0) {return false;}
232
233// +--
234// | Hide the item, if it's visible.
235// +--
236
237if (jQuery('#' + divid).css('display') != 'none') {
238
239     setTimeout(function() {
240
241          jQuery('#' + divid).hide('fade', DelayFader);
242
243     }, DelayDestroyFader);
244
245     setTimeout(function() {
246
247          jQuery('#' + divid).css({'display': 'none'});
248
249     }, DelayDestroyFader + DelayFader + 10);
250
251} // End of if statement.
252
253// +--
254// | Destroy the item.
255// +--
256
257setTimeout(function() {
258
259     jQuery('#' + divid).remove();
260
261}, DelayDestroyFader + DelayFader + 20);
262
263// +--
264// | Return false.
265// +--
266
267return false;
268
269} // End of function.
270
271// +------------------------------------------------------------------+
272// | Function: scrollToTop                                            |
273// +------------------------------------------------------------------+
274
275function scrollToTop(options) {
276
277// +--
278// | Handle defaults and options.
279// +--
280
281var defaults = {divid: '', offset: 0, speed: DelayFader};
282
283var options  = jQuery.extend(defaults, options);
284
285// +--
286// | If we received a div to scroll to, set options for it.
287// +--
288
289if (options.divid) {
290
291     if (!(jQuery('#' + options.divid).length == 0)) {
292
293          var offset    = jQuery('#' + options.divid).offset();
294
295          options.offset = offset.top - 15;
296
297          if (options.offset < 0) {options.offset = 0;}
298
299     } // End of if statement.
300
301} // End of if statement.
302
303// +--
304// | Correct the offset.
305// +--
306
307var window_height = jQuery(window).height();
308var page_height   = jQuery('body').height();
309
310if (page_height <= 0) {return false;}
311
312if ((page_height - options.offset) < window_height) {
313
314     options.offset = page_height - window_height;
315
316} // End of if statement.
317
318// +--
319// | Scroll to the top of the page, less any offset requested.
320// +--
321
322jQuery('html, body').animate({scrollTop: options.offset}, options.speed);
323
324// +--
325// | Return false.
326// +--
327
328return false;
329
330} // End of function.
331
332// +------------------------------------------------------------------+
333// | Function: formGetObject                                          |
334// +------------------------------------------------------------------+
335
336function formGetObject(formid) {
337
338// +--
339// | Check to see if the form is defined.  If not, exit.
340// +--
341
342if (!formid)   {return false;}
343
344if (jQuery('#' + formid).length == 0)   {return false;}
345
346var formobj  = new Object();
347
348formobj.object = {};
349
350// +--
351// | Get the form field values.  This does not 
352// | handle file inputs (jQuery Feature).
353// +--
354
355jQuery.each(jQuery('#' + formid).serializeArray(), function() {
356
357     var arrayfield = this.name.match(/\[\]$/);
358
359     var fieldname  = this.name.replace(/\[\]$/,'');
360
361     if (fieldname == 'sid' || fieldname == 'portrelay' || fieldname == 'ajax') {
362
363          return true;
364
365     } else if (formobj.object[fieldname] !== undefined) {
366
367          if (!formobj.object[fieldname].push) {
368
369               formobj.object[fieldname] = [formobj.object[fieldname]];
370
371          } // End of if statement.
372
373          formobj.object[fieldname].push(this.value || '');
374
375     } else if (arrayfield) {
376
377          formobj.object[fieldname] = [];
378
379          formobj.object[fieldname].push(this.value || '');
380
381     } else {
382
383          formobj.object[fieldname] = this.value || '';
384
385     } // End of if statement.
386
387});
388
389// +--
390// | Get the form field values for all file inputs.
391// +--
392
393jQuery('#' + formid + ' input[type=file]').each(function(){
394
395     formobj.object[jQuery(this).attr('name')] = jQuery(this).val();
396
397});
398
399// +--
400// | Return the form object.
401// +--
402
403return formobj;
404
405} // End of function.
406
407// +------------------------------------------------------------------+
408// | Function: postAJAX                                               |
409// +------------------------------------------------------------------+
410
411function postAJAX(params) {
412
413// +--
414// | Submit AJAX to the system.
415// +--
416
417if (!params.callback)       {return false;}
418if (!params.callbackparams) {return false;}
419
420// +--
421// | Post the info and return the result to the callback function.
422// +--
423
424jQuery.ajax({'type':     'POST',
425             'url':      thisURL,
426             'data':     {'app': 'core', 'ns': 'ajaxrequest', 'sid': thisSID, 'ajax': 1, 'ajax_request': jQuery.toJSON(params.callbackparams.ajax_request)},
427             'success':  function(data) {params.callbackparams.ajax_response = data;    window[params.callback](params.callbackparams);},
428             'error':    function(data) {params.callbackparams.ajax_response = 'ERROR: Failed jQuery ajax request.'; window[params.callback](params.callbackparams);},
429             'dataType': 'text',
430             'async':    params.async,
431             'cache':    false});
432
433
434} // End of function.
435
436// +------------------------------------------------------------------+
437// | End of File                                                      |
438// +------------------------------------------------------------------+

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.