Jump to content

Using utility modules

  1. ips.utils.position

    Description Dealing with element positioning - getting current positions, working out new positions, and so on - is a common task in a web application such as IPS4. This utility aims to make that easier by providing some methods to do the calculations for you.   Methods object getElemPosition( mixed elem ) Returns various positioning information for the provided element. elem DOM element or jQuery object containing the element to work with Returned object:
  2. ips.utils.time

    Description The time utility provides methods for working with timestamps.   Methods string readable( number timestamp ) Returns the time as an approximate relative string, e.g. 8 hours ago, 2 days ago, Just now. timestamp UNIX timestamp to use to generate the time string   boolean isDST() Determines whether the user is currently in daylight savings (DST).   boolean isValidDateObj( mixed date ) Determines whether the provided date i
  3. ips.utils.url

    Description The URL utility makes it easier to work with URLs by returning comprehenive information about a URL you supply, including query parameters, protocol, domain and more. The URL utility is a wrapper around the parseUri library by Steven Levithan.   Example ips.utils.url.getParam('page', 'http://www.test.com/index.php?section=example&page=about'); // -> about   Methods string getParam( string param, string url ) Returns the value of the paramet
  4. ips.utils.cookie

    Description This utility provides methods for working with cookies in IPS4. It deals with cookie prefixes and other setting behind the scenes so that you can interact with cookies without having to handle those aspects manually.   Example ips.utils.cookie.set( 'myKey', 'Hello world', true ); // Sets a sticky cookie ips.utils.cookie.get( 'myKey' ); // -> Hello world ips.utils.cookie.unset( 'myKey' ); ips.utils.cookie.get( 'myKey' ); // -> undefined   Methods
  5. ips.utils.db

    Description Modern browsers provide a mechanism for storing persistent data directly on a user's computer, called localStorage. This utility exposes some methods for working with localStorage in IPS4.    Example ips.utils.db.set( 'myCategory', 'myKey', 'Hello world' ); ips.utils.db.get( 'myCategory', 'myKey' ); // -> Hello world ips.utils.db.isEnabled(); // -> true ips.utils.db.removeByType( 'myCategory' ); // -> 1   Methods void set( string type, string
×
×
  • Create New...