This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.instanceOf = function(e){ | |
return (this instanceof e) ? true : false; | |
}; | |
/* | |
Usage: | |
var f = function(){ | |
//function code here | |
} | |
var g = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getStyleValue = function(style, selector, stylesheet){ | |
var ss = typeof(stylesheet) !== 'undefined' ? [stylesheet] : document.styleSheets; | |
for(i in ss){ | |
var s = ss[i]; | |
if(!s.cssRules) | |
continue; | |
for(j in s.cssRules){ | |
var rule = s.cssRules[j]; | |
if(rule.selectorText && rule.selectorText.split(',').indexOf(selector) !== -1) | |
return rule.style[style]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// currently does not work. | |
if(!document.createStyleSheet){ | |
document.createStyleSheet = (function(){ | |
function createStyleSheet(href){ | |
if(href){ | |
var element = document.createElement('link'); | |
element.type = 'text/css'; | |
element.rel = 'stylesheet'; | |
element.href = href; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.binaryToUnicode = function(){ | |
var binary = this.replace(/\s*[01]{8}\s*/g, function(b) { | |
return String.fromCharCode(parseInt(b, 2)) | |
}) | |
var messageArray = binary.split(','); | |
var unicodeString = ''; | |
for(var i = 0; i < messageArray.length;i++){ | |
unicodeString += String.fromCharCode(messageArray[i]); | |
} | |
return unicodeString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addEvent = function(el,e,f){ | |
((el.attachEvent) ? el.attachEvent('on'+e,f) : el.addEventListener(e,f,false); | |
} | |
/* USAGE: | |
var el = document.createElement('div'); | |
addEvent(el, 'event as string', function name or anon function(e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Created by Rajiv Gomer | |
* Released under the MIT license | |
* Date: 2018-01-11 | |
* Tested using SharePoint 2013/16/19 Classic Mode | |
* Parameters: 1. URL (string, Required) | |
* 2. Url Title (Default: URL) | |
* 3. Timer (Integer, Default: 10) | |
* 4. Override (boolean, Default: false, true makes the countdown timer clickable to stop the redirect) | |
* Usage: 1. SP.Redirect("<Required string: URL>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Created by Rajiv Gomer | |
* Released under the MIT license | |
* Date: 2018-03-08 | |
* Tested using SharePoint 2013 On-Prem | |
* Parameters: 1. None | |
* 2. List View Name (string) | |
* Usage: 1. SP.List.touchItems(); | |
* 2. SP.List.touchItems('<List View Name>'); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Title: SP.List.deleteItems.js | |
* Created by Rajiv Gomer | |
* Released under the MIT license | |
* Date: 2018-03-09 | |
* Tested using SharePoint 2013 On-Prem | |
* Parameters: 1. Required: List View Name (string) | |
* Usage: 1. SP.List.deleteItems('<List View Name>'); | |
* Usage: 2. new SP.ClientContext.get_current().get_web().get_lists().getByTitle('<List Name>').deleteItems('<List View Name>'); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Title: SP.List.recycleItems.js | |
* Created by Rajiv Gomer | |
* Released under the MIT license | |
* Date: 2018-03-09 | |
* Tested using SharePoint 2013 On-Prem | |
* Parameters: 1. Required: List View Name (string) | |
* Usage: 1. SP.List.recycleItems('<List View Name>'); | |
* Usage: 2. new SP.ClientContext.get_context().get_web().get_lists().getByTitle('<List Name>').recycleItems('<List View Name>'); | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paramters: lookupFieldName - Internal name of field | |
// lookupFieldValue - ID of lookup item | |
SP.CamlQuery.createLookupQuery = function SP_CamlQuery$createLookupQuery(lookupFieldName,lookupFieldValue){ | |
this.lookupFieldName = lookupFieldName || null; | |
if(this.lookupFieldName === null){ | |
console.error('Missing Parameter(s): lookupFieldname and lookupFieldValue'); | |
return; | |
} | |
this.lookupFieldValue = lookupFieldValue || null; |
OlderNewer