Skip to content

JoHoN8/pd-sputil

Repository files navigation

pdsputil

Common utilities for working with SharePoint

pdsputil.spSaveForm([formId], saveButtonValue) ⇒ void

Saves SP out of the box form Editform, Newform

Kind: static method of pdsputil

Param Type
[formId] string
saveButtonValue string

pdsputil.domReady(callback, context) ⇒ void

Invokes the callback when dom is ready context is passed to the call back as first parameter

Kind: static method of pdsputil

Param Type
callback requestCallback
context object

pdsputil.getDataType(item) ⇒ string

Return the javascript type in lowercase, ex array object

Kind: static method of pdsputil

Param Type
item *

pdsputil.elementTagName(element) ⇒ string

Returns a lower case element tag name ex div

Kind: static method of pdsputil

Param Type
element JQuery | HTMLElement

pdsputil.argsConverter(args, startAt) ⇒ Array

Takes a functions arguments and converts it to an array

Kind: static method of pdsputil

Param Type
args Array
startAt number

pdsputil.arrayInsertAtIndex(array, index) ⇒ Array

Inserts an item or items starting at the passed index

Kind: static method of pdsputil

Param Type
array Array
index number

pdsputil.arrayRemoveAtIndex(array, index) ⇒ Array

Removes an item from index of the passed array

Kind: static method of pdsputil

Param Type
array Array
index number

pdsputil.encodeAccountName(acctName) ⇒ string

Adds the beginning string to an email and encodes it for url use

Kind: static method of pdsputil

Param Type
acctName string

pdsputil.promiseDelay(time) ⇒ promise

Returns a promise that will resolve in the given time or default to 5 secs

Kind: static method of pdsputil

Param Type
time number

pdsputil.exportToCSV(filename, rows) ⇒ void

Creates a CSV file from the passed array

Kind: static method of pdsputil

Param Type
filename string
rows Array.<Array.<string>>

pdsputil.getPageInfo() ⇒ object

Returns the SP pageObj that is on all SP pages

Kind: static method of pdsputil

pdsputil.spGotoUrl(url) ⇒ void

Navigates the user to the url passed

Kind: static method of pdsputil

Param Type
url string

pdsputil.spSearchResultsCleaner(results, neededProps) ⇒ Array.<object>

Cleans the ajax search results to an array of objects

Kind: static method of pdsputil

Param Type
results Array.<object>
neededProps Array.<string>

pdsputil.pageEditModeTest() ⇒ boolean

Lets the script know if the SP page is in edit mode

Kind: static method of pdsputil

pdsputil.hideRibbon() ⇒ void

Hides the ribbon at the top of an SP page

Kind: static method of pdsputil

pdsputil.URLparameters() ⇒ object

Returns an object of the search properties in a url

Kind: static method of pdsputil

pdsputil.waitForScriptsReady(scriptName) ⇒ Promise

Returns a promise that is resolved when the passed SP (only) script file is loaded

Kind: static method of pdsputil

Param Type
scriptName string

pdsputil.tableRowLoop(table, cb) ⇒ void

Loops through all rows of the passed table

Kind: static method of pdsputil

Param Type
table JQuery
cb function

pdsputil.loadSPScript(fileName) ⇒ Promise

Returns a promise that resolves when the script file is loaded, any script file

Kind: static method of pdsputil

Param Type
fileName string

pdsputil.validGuid(guid) ⇒ boolean

Test a string to ensure it is a valid guid

Kind: static method of pdsputil

Param Type
guid string

pdsputil.getURLOrigin() ⇒ string

Returns the origin of the current site

Kind: static method of pdsputil

pdsputil.createGUID() ⇒ string

Creates a SharePoint GUID in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Kind: static method of pdsputil

pdsputil~sesStorage

Kind: inner class of pdsputil

new sesStorage()

Class creates a new instance of sesStorage

sesStorage.getItem(key) ⇒ *

Retrieves an item from session storage

Kind: instance method of sesStorage

Param Type
key string

sesStorage.setItem(key, value) ⇒ void

Stores an item from session storage

Kind: instance method of sesStorage

Param Type
key string
value *

sesStorage.removeItem(key) ⇒ void

Removes an item from session storage

Kind: instance method of sesStorage

Param Type
key string

pdsputil~Sublish

Kind: inner class of pdsputil

new Sublish()

Class creates a new pub sub object

sublish.publish(id, ...args) ⇒ void

Publishes data to subscribers

Kind: instance method of Sublish

Param Type Description
id string
...args args all items passed in will be added as parameters of function with same id

sublish.subscribe(id, fn) ⇒ void

Subscribes a function to an id for the fn the function will recieve whatever arguments are passed to publish so your parameters to the function should be whatever you are going to pass publish to the given id

Kind: instance method of Sublish

Param Type
id string
fn subscription

sublish.unsubscribe(id, fn) ⇒ void

Unsubscribes a function for the fn the function passed must be an exact reference to the function or it will not match

Kind: instance method of Sublish

Param Type
id string
fn unsub

sublish.clear(id) ⇒ void

Clears the internal cache so all subscribed function all be removed

Kind: instance method of Sublish

Param Type
id string

pdsputil~requestCallback ⇒ void

Function that is called when the dom is ready

Kind: inner typedef of pdsputil

Param Type
context *

pdsputil~subscription ⇒ void

function typedef for callback to subscribe to an emitted event.

Kind: inner typedef of pdsputil
Returns: void - responseMessage

Type Description
args whatever you pass into publish will be passed in here

pdsputil~unsub ⇒ void

This function is a identifier for matching so it can be removed.

Kind: inner typedef of pdsputil
Returns: void - - responseMessage

Type Description
args whatever you pass into publish will be passed in here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published