1 2var utilityClass = new utilityClass(); 3 4 5//Object.defineProperty(console, '_commandLineAPI', 6// { 7// get: function () { 8 9// throw "Console is disabled"; 10// } 11 12// }); 13 14function pageLoad() { 15 $(document).ready(function () { 16 17 18 //(function () { 19 // try { 20 // var $_console$$ = console; 21 // Object.defineProperty(window, "console", { 22 // get: function () { 23 // if ($_console$$._commandLineAPI) 24 // throw "Sorry, for security reasons, the script console is deactivated on netflix.com"; 25 // return $_console$$ 26 // }, 27 // set: function ($val$$) { 28 // $_console$$ = $val$$ 29 // } 30 // }) 31 // } catch ($ignore$$) { 32 // } 33 //})(); 34 35 //with ((window && window.console && window.console._commandLineAPI) || {}) { 36 // // your script here. 37 38 39 // var _z = console; 40 // Object.defineProperty(window, "console", { 41 // get: function () { 42 // if (_z._commandLineAPI) { 43 // throw "Sorry, Can't execute scripts!"; 44 // } 45 // return _z; 46 // }, 47 // set: function (val) { 48 // _z = val; 49 // } 50 // }); 51 52 53 54 //} 55 56 57 58 //console.log(utilityClass.doesBrowserSupportLocalStorage()); 59 60 if (~window.location.href.toLowerCase().indexOf("error/localstorage")) { 61 // Found it 62 } else { 63 if (!utilityClass.doesBrowserSupportLocalStorage()) { 64 65 window.location.href = njpn_atwd.settings.baseUrl() + 'error/localStorage'; 66 67 68 } 69 } 70 71 72 73 74 $('.input-group.date').datepicker({ 75 todayBtn: "linked", 76 todayHighlight: true, 77 forceParse: false, 78 autoclose: true 79 }); 80 81 $('.input-group.date input[type=text]').mask('99/99/9999'); 82 83 $("#btnCloseDivError").click(function () { 84 $("#divError").hide(); 85 }); 86 87 //Set Default for all Modals 88 $.fn.modal.prototype.constructor.Constructor.DEFAULTS.backdrop = 'static'; 89 $.fn.modal.prototype.constructor.Constructor.DEFAULTS.keyboard = false; 90 91 document.title = njpn_atwd.settings.webAppTitle(); 92 93 94 95 $(document).on('change', '.btn-file :file', function () { 96 var input = $(this), 97 numFiles = input.get(0).files ? input.get(0).files.length : 1, 98 label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); 99 input.trigger('fileselect', [numFiles, label]); 100 }); 101 102 103 $('.btn-file :file').on('fileselect', function (event, numFiles, label) { 104 105 var input = $(this).parents('.input-group').find(':text'), 106 log = numFiles > 1 ? numFiles + ' files selected' : label; 107 108 if (input.length) { 109 input.val(log); 110 } else { 111 if (log) alert(log); 112 } 113 114 }); 115 116 117 //Make Modals Stackable
118 /////////////////////////////////////////////// 119 120 $('.modal').on('hidden.bs.modal', function (event) { 121 $(this).removeClass('fv-modal-stack'); 122 $('body').data('fv_open_modals', $('body').data('fv_open_modals') - 1); 123 }); 124 125 126 $('.modal').on('shown.bs.modal', function (event) { 127 128 // keep track of the number of open modals 129 130 if (typeof ($('body').data('fv_open_modals')) === 'undefined') { 131 $('body').data('fv_open_modals', 0); 132 } 133 134 135 // if the z-index of this modal has been set, ignore. 136 137 if ($(this).hasClass('fv-modal-stack')) { 138 return; 139 } 140 141 $(this).addClass('fv-modal-stack'); 142 143 $('body').data('fv_open_modals', $('body').data('fv_open_modals') + 1); 144 145 $(this).css('z-index', 1040 + (10 * $('body').data('fv_open_modals'))); 146 147 $('.modal-backdrop').not('.fv-modal-stack') 148 .css('z-index', 1039 + (10 * $('body').data('fv_open_modals'))); 149 150 151 $('.modal-backdrop').not('fv-modal-stack') 152 .addClass('fv-modal-stack'); 153 154 });
155 ////////////////////////////////////////////////////// 156 157 158 159 160 }); 161 162 163 164 165 166 167 168 169 $(".summernote").on("summernote.paste", function (e) { 170 171 var thisNote = $(this); 172 //console.log(thisNote) 173 var updatePastedText = function (someNote) { 174 //console.log('In paste function') 175 var original = someNote.summernote('code'); 176 // console.log(original) 177 var cleaned = CleanPastedHTML(original); //this is where to call whatever clean function you want. I have mine in a different file, called CleanPastedHTML. 178 179 //console.log(cleaned) 180 someNote.summernote('code', cleaned); 181 //someNote.code('').html(cleaned); //this sets the displayed content editor to the cleaned pasted code. 182 }; 183 setTimeout(function () { 184 //the function is called before the text is really pasted. 185 updatePastedText(thisNote); 186 }, 10); 187 188 }); 189 190 function CleanPastedHTML(input) { 191 // 1. remove line breaks / Mso classes 192 var stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g; 193 var output = input.replace(stringStripper, ' '); 194 // 2. strip Word generated HTML comments 195 var commentSripper = new RegExp('<!--(.*?)-->', 'g'); 196 //var output = output.replace(commentSripper, ''); 197 output = output.replace(commentSripper, ''); 198 var tagStripper = new RegExp('<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>
198', 'gi'); 199 // 3. remove tags leave content if any 200 output = output.replace(tagStripper, ''); 201 // 4. Remove everything in between and including tags '<style(.)style(.)>' 202 var badTags = ['style', 'script', 'applet', 'embed', 'noframes', 'noscript']; 203 204 for (var i = 0; i < badTags.length; i++) { 205 tagStripper = new RegExp('<' + badTags[i] + '.*?' + badTags[i] + '(.*?)>', 'gi'); 206 output = output.replace(tagStripper, ''); 207 } 208 // 5. remove attributes ' style="..."' 209 var badAttributes = ['style', 'start']; 210 for (var ii = 0; ii < badAttributes.length; ii++) { 211 var attributeStripper = new RegExp(' ' + badAttributes[ii] + '="(.*?)"', 'gi'); 212 output = output.replace(attributeStripper, ''); 213 } 214 215 //console.log(output) 216 return output; 217 } 218 219} 220 221window.onbeforeunload = function (e) { 222 223 224 //var timer = null; 225 //if (timer) 226 // return; // when multiple requests are sent at same time 227 //timer = setTimeout(function () { 228 // timer = null; 229 // waitingDialog.show(); 230 //}, webapps.settings.waitForDialogTime()); 231 232 233 234 //users.methods.insertPortalLogExit().done(function (response) { 235 // //console.log(JSON.parse(response.d)); 236 // //alert(JSON.parse(response.d)) 237 //}).fail(function (jqXHR, textStatus, errorThrown) { 238 // // utilityClass.insertErrorLog(navigator.userAgent, "Error", "An unknown error occured while retrieving data from the database.<br />", errorThrown, window.location.href.toString(), 'divError', 'PARCC'); 239 // //console.log(errorThrown); 240 //}).always( 241 //function (jqXHR, textStatus) { 242 // if (timer) 243 // clearTimeout(timer); 244 // else 245 // waitingDialog.hide(); 246 // timer = null; 247 //} 248 249 ////waitingDialog.hide() 250 //); 251 252 253 254 255}; 256 257var namespace = function (name, separator, container) { 258 var ns = name.split(separator || '.'), 259 o = container || window, 260 i, 261 len; 262 for (i = 0, len = ns.length; i < len; i++) { 263 o = o[ns[i]] = o[ns[i]] || {}; 264 } 265 return o; 266}; 267 268window.onerror = function (msg, url, line, col, error) { 269 // Note that col & error are new to the HTML 5 spec and may not be 270 // supported in every browser. It worked for me in Chrome. 271 var extra = !col ? '' : '\ncolumn: ' + col; 272 extra += !error ? '' : '\nerror: ' + error; 273 console.log(line); 274 console.log(extra); 275 276 // You can view the information in an alert to see things working like this: 277 //alert("Error: " + msg + "\nurl: " + url + "\nline: " + line + extra); 278 utilityClass.insertErrorLog(navigator.userAgent, "Global Error", "An unhandled error has occured.", msg, url); 279 280 // TODO: Report this error via ajax so you can keep track 281 // of what pages have JS issues 282 283 var suppressErrorAlert = true; 284 // If you return true, then error alerts (like in older versions of 285 // Internet Explorer) will be suppressed. 286 return suppressErrorAlert; 287}; 288 289if (window.location.href.toLowerCase().indexOf('login.aspx') !== -1) { 290 //do nothing 291 292 // setup the dialog 293} 294else if (window.location.href.toLowerCase().indexOf('timeout.aspx') !== -1) { 295 //do nothing 296 297 // setup the dialog 298} 299else if (window.location.href.toLowerCase().indexOf('dbsearch.aspx') !== -1) { 300 //do nothing 301 302 // setup the dialog 303} 304else if (window.location.href.toLowerCase().indexOf('application.aspx') !== -1) { 305 //do nothing 306 307 // setup the dialog 308} 309else if (window.location.href.toLowerCase().indexOf('thankyou.aspx') !== -1) { 310 //do nothing 311 312 // setup the dialog 313} 314else { 315 //$.sessionTimeout({ 316 // message: 'Your session will be locked in 15 minutes.', 317 // keepAliveUrl: 'http://localhost/webapps/keepAlive.aspx', 318 // logoutUrl: 'http://localhost/webapps/login.aspx?message=loggedOut', 319 // redirUrl: 'http://localhost/webapps/login.aspx?message=timedOut', 320 // warnAfter: 2700000, 321 // redirAfter: 3600000 322 //}); 323 324 //$.sessionTimeout({ 325 // message: 'Your session will be locked in one minute.',
326 // keepAliveUrl: 'https://spara.njpn.org/keepAlive.aspx', 327 // logoutUrl: 'https://spara.njpn.org/login.aspx?message=loggedOut', 328 // redirUrl: 'https://spara.njpn.org/login.aspx?message=timedOut', 329 // warnAfter: 2700000, 330 // redirAfter: 3600000 331 //}); 332} 333 334//$(function () { 335// $('.input-group.date').datepicker({ 336// todayBtn: "linked", 337// todayHighlight: true, 338// forceParse: false, 339// autoclose: true 340// }); 341 342// $('.input-group.date input[type=text]').mask('99/99/9999'); 343 344//}); 345 346//Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq); 347 348//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq); 349 350try { 351 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq); 352 353 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq); 354 355} 356catch (e) { 357 358 359} 360 361function beginReq(sender, args) { 362 // shows the Popup 363 364 waitingDialog.show(); 365} 366function endReq(sender, args) { 367 // shows the Popup 368 369 //alert($('#ContentPlaceHolderForm_divInfo').is(":visible")); 370 371 //if ($('#ContentPlaceHolderForm_divInfo').is(":visible") == true) { 372 // setTimeout("scrollToBottom()", 500); 373 //} 374 375 waitingDialog.hide(); 376 377 try{ 378 initPage(); 379 } 380 catch (e) { 381 382 383 } 384 385} 386 387//$(document).ready(function () { 388// $('#divError1').hide(); 389// initPage() 390//}); 391 392//function initPage() { 393// if (typeof localStorage === 'object') { 394// try { 395// localStorage.setItem('localStorage', 1); 396// localStorage.removeItem('localStorage'); 397// } catch (e) { 398// Storage.prototype._setItem = Storage.prototype.setItem; 399// Storage.prototype.setItem = function () { }; 400 401// $("#divError1").addClass("alert alert-danger alert-dismissable errorMessageDiv"); 402// $('#divError1').show(); 403// $('#divError1Message').html('Your web browser does not support storing settings locally. In Safari, the most common cause of this is using "Private Browsing Mode". Some settings may not save or some features may not work properly for you.'); 404 405// } 406// } 407 408//}
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.