1 //unassociated functions
3 static storageAvailable(storage_type:string):number {
5 var storage = window[storage_type];
6 storage.setItem('x', 'x');
7 storage.removeItem('x');
16 static detectBrowser():number {
17 if((navigator.userAgent.indexOf('Opera') || navigator.userAgent.indexOf('OPR')) != -1 )
22 else if(navigator.userAgent.indexOf('Chrome') != -1 )
24 console.log('Chrome');
27 else if(navigator.userAgent.indexOf('Safari') != -1)
29 console.log('Safari');
32 else if(navigator.userAgent.indexOf('Firefox') != -1 )
34 console.log('FireFox');
37 else if(navigator.userAgent.indexOf('MSIE') != -1 )
50 //gets json keys by regex test
51 static getJSONPropertiesByKeyName(JSON_obj:object, regex_string:string):string[]{
52 var regex:any = new RegExp("^" + regex_string + "$");
53 var rtnArray:string[] = Array();
54 for (let key in JSON_obj)
60 //send alert to 4chanx
61 static alert4ChanX(message:string, type:string, time?:number):void{
62 var detail:object = {type: type, content: message, lifetime: time};
63 var event:any = new CustomEvent('CreateNotification', {bubbles: true, detail: detail});
64 document.dispatchEvent(event);
67 static getJSON = function(url, callback, extra, ...all_extra) {
68 var xhr:any = new XMLHttpRequest();
69 xhr.open('GET', url, true);
70 xhr.responseType = 'json';
71 xhr.onload = function() {
72 var status = xhr.status;
74 callback(null, xhr.response, extra, ...all_extra);