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-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
var siteurl = _spPageContextInfo.webAbsoluteUrl; | |
var formDigest; | |
var generateCustomAction = function(location,sequence,title,description,url){ | |
location = location || 'ScriptLink'; | |
sequence = sequence || 1000; | |
title = title || 'Test Custom Action'; | |
description = description || 'Test Description'; | |
url = url || '~sitecollection/Style Library/scripts/jquery-3.3.1.js'; | |
return JSON.stringify({ | |
'__metadata': { |
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
/* Adds isAfter, isBefore, and isBetween functions to the Date object | |
* isAfter(<Date Object>) OR isAfter('MM/DD/YYYY') | |
* isBefore(<Date Object>) OR isBefore('MM/DD/YYYY') | |
* isBetween(<Start Date Object>, <End Date Object>) OR isBetween('MM/DD/YYYY','MM/DD/YYYY') | |
* | |
* Assuming todays' date is 12/25/2018 | |
* var date = new Date(); | |
* date.isAfter('12/12/2018') returns true; | |
* date.isBefore('12/12/2018') returns false; | |
* date.isBetween('12/1/2018','12/31/2018') returns true; |
OlderNewer