Skip to content

Instantly share code, notes, and snippets.

@wpsmithtwc
Last active May 17, 2017 16:49
Show Gist options
  • Save wpsmithtwc/d448f7edaed4646b7070d956abf720fb to your computer and use it in GitHub Desktop.
Save wpsmithtwc/d448f7edaed4646b7070d956abf720fb to your computer and use it in GitHub Desktop.
Based on WayPoints v3.1.1
/*!
* Script Name: iVision
* Core iVision Script
* @author Travis Smith <[email protected]>
*/
_EnsureJSNamespace('iVision');
var iVision = iVision || {};
/*** Get SharePoint Workspace ***/
iVision.getWorkspace = function () {
iVision.workspace = document.getElementById("s4-workspace");
iVision.workspace = 'undefined' === typeof iVision.workspace ? $('#s4-workspace') : iVision.workspace;
// return iVision.workspace[0];
return iVision.workspace;
};
// From core.js
// SPAnimationUtility.BasicAnimator.GetWindowScrollPosition()
iVision.GetWindowScrollPosition = function () {
var scrOfX = 0;
var scrOfY = 0;
var workspace = document.getElementById("s4-workspace");
if (workspace != null) {
scrOfY = workspace.scrollTop;
scrOfX = workspace.scrollLeft;
}
else {
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
}
if (IsNullOrUndefined(scrOfY))
scrOfY = 0;
if (IsNullOrUndefined(scrOfX))
scrOfX = 0;
return {
x: scrOfX,
y: scrOfY
};
};
iVision.getBody = function () {
iVision.body = document.getElementById("s4-bodyContainer");
return iVision.body;
};
iVision.bodyClasses = function () { };
/*
iVision.bodyClasses = function(){
return;
if ( "undefined" == typeof _spPageContextInfo ) {
return;
}
var siteColClass =
'sitecol' +
_spPageContextInfo
.siteServerRelativeUrl
.replace(///g, "-")
.toLowerCase()
;
var siteClass =
'site' +
_spPageContextInfo
.webServerRelativeUrl
.replace(///g, "-")
.toLowerCase()
;
document.body.className = document.body.className + ' ' + siteColClass + ' ' + siteClass;
};*/
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionCore');
/*!
* Script Name: iVisionjQ
* Main AGG JS
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
jQuery.noConflict();
(function ($, window, document, undefined) {
//"use strict";
// Modify jQuery
// Store a reference to the original remove method.
var ojQ = {
scrollTop: jQuery.fn.scrollTop,
scrollLeft: jQuery.fn.scrollLeft
};
// Define overriding method.
$.fn.scrollTop = function () {
// Log the fact that we are calling our override.
//console.log("Override scrollTop method");
// Execute the original method.
return iVision.GetWindowScrollPosition().y;
};
// Define overriding method.
$.fn.scrollLeft = function () {
// Log the fact that we are calling our override.
//console.log("Override scrollLeft method");
// Execute the original method.
return iVision.GetWindowScrollPosition().x;
};
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQ');
})(jQuery, window, document);
// Fire within SharePoint
//_spBodyOnLoadFunctionNames.push("iVision.main");
jQuery(document).on("SPReady", function () {
console.log('SPReady');
});
/*!
* Script Name: iVisionScripts
* iVision Script Manager
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
_EnsureJSClass('iVision.Script');
(function () {
/** SCRIPT Class **/
iVision.Script = function(name,url,dep) {
if ( _.isUndefined(name) ) {
throw 'iVision.Script requires a name';
}
// Create script object
this.name = name;
this.url = url;
this.registered = false;
this.duplicate = [];
this.dep = [];
var s = this;
// Check for duplicate
if (iVision.Script.isDuplicate(name)) {
iVision.scripts[s.name].duplicate.push(s);
return false;
}
// Add dependencies
if ( !_.isUndefined(dep) ) {
if ( _.isString(dep) || _.isObject(dep) ) {
this.addDep(dep);
} else if( _.isArray(dep) ) {
_.each(dep,this.addDep);
}
}
// Register
this._register();
iVision.scripts[s.name] = s;
return s;
};
// Determines whether the current script has a duplicate
iVision.Script.prototype.hasDuplicate = function () {
if (this.duplicate.length > 0) {
return true;
}
return false;
}
// Determines whether the current script has a URL property
iVision.Script.prototype.hasURL = function () {
if ( !_.isUndefined(this.url) ) {
return true;
}
return false;
};
// private: Registers the script with SharePoint
iVision.Script.prototype._register = function () {
if ( !this.registered && this.hasURL() ) {
SP.SOD.registerSod(this.name, this.url);
this.registered = true;
}
}
iVision.Script.prototype._registerDep = function() {
if ( this.dep.length > 0 ) {
_.each(this.dep,iVision.script.register);
}
}
iVision.Script.prototype.addDep = function (name, url) {
SP.SOD.registerSodDep(this.name, name);
if (!_.isUndefined(url)) {
var dep = new iVision.Script(name, url);
dep._register();
}
this.dep.push(name);
};
// Methods
iVision.Script.isDuplicate = function (name) {
if (!_.isUndefined(iVision.scripts[name])) {
return true;
}
return false;
};
iVision.Script.isScript = function (object) {
if ('object' !== typeof object) {
return false;
}
if (object instanceof iVision.Script) {
return true;
}
return false;
};
iVision.Script.register = function (script) {
if (iVision.Script.isScript(script)) {
return false;
}
if (!script.registered && script.hasURL()) {
SP.SOD.registerSod(script.name, script.url);
script.registered = true;
iVision.scripts[script.name] = script;
if (_.isUndefined(iVision.scripts.registered[script.name])) {
iVision.scripts.registered.push(script.name);
}
return true;
}
return false;
};
iVision.Script.add = function (name, url, dep) {
if (iVision.Script.isDuplicate(name)) {
return null;
}
return new iVision.Script(name, url, dep);
}
iVision.Script.getRegistered = function () {
var registered = [];
_.each(iVision.scripts, function (value, key, scripts) {
if (iVision.Script.isScript(value)) {
registered.push(key);
}
});
return registered;
};
iVision.Script.getScript = function (name) {
return iVision.scripts[name];
};
iVision.Script.getScriptByURL = function (url) {
return _.find(iVision.scripts, function (value, key, scripts) {
if (iVision.Script.isScript(value)) {
return (url === _.property('url')(value));
}
});
};
iVision.Script.getScriptByFilename = function (filename) {
return _.find(iVision.scripts, function (value, key, scripts) {
if (iVision.Script.isScript(value)) {
return (_.property('url')(value).indexOf(filename) > -1);
}
});
};
// Determine available scripts
iVision.scripts = {
registered: iVision.Script.getRegistered(),
hasjQuery: ("function" !== typeof jQuery),
hasBootstrap: ("function" !== typeof jQuery && jQuery.isFunction(jQuery.fn.modal) && jQuery.isFunction(jQuery.fn.emulateTransitionEnd)),
hasWaypoints: ("function" !== typeof Waypoint),
add: iVision.Script.add
};
})();
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionScripts');
/**
* UTILITIES
*
* @author Travis Smith <[email protected]>
*/
_EnsureJSNamespace('_');
// Underscore.js 1.7.0
// http://underscorejs.org
// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function () { var n = this, t = n._, r = Array.prototype, e = Object.prototype, u = Function.prototype, i = r.push, a = r.slice, o = r.concat, l = e.toString, c = e.hasOwnProperty, f = Array.isArray, s = Object.keys, p = u.bind, h = function (n) { return n instanceof h ? n : this instanceof h ? void (this._wrapped = n) : new h(n) }; "undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = h), exports._ = h) : n._ = h, h.VERSION = "1.7.0"; var g = function (n, t, r) { if (t === void 0) return n; switch (null == r ? 3 : r) { case 1: return function (r) { return n.call(t, r) }; case 2: return function (r, e) { return n.call(t, r, e) }; case 3: return function (r, e, u) { return n.call(t, r, e, u) }; case 4: return function (r, e, u, i) { return n.call(t, r, e, u, i) } } return function () { return n.apply(t, arguments) } }; h.iteratee = function (n, t, r) { return null == n ? h.identity : h.isFunction(n) ? g(n, t, r) : h.isObject(n) ? h.matches(n) : h.property(n) }, h.each = h.forEach = function (n, t, r) { if (null == n) return n; t = g(t, r); var e, u = n.length; if (u === +u) for (e = 0; u > e; e++) t(n[e], e, n); else { var i = h.keys(n); for (e = 0, u = i.length; u > e; e++) t(n[i[e]], i[e], n) } return n }, h.map = h.collect = function (n, t, r) { if (null == n) return []; t = h.iteratee(t, r); for (var e, u = n.length !== +n.length && h.keys(n), i = (u || n).length, a = Array(i), o = 0; i > o; o++) e = u ? u[o] : o, a[o] = t(n[e], e, n); return a }; var v = "Reduce of empty array with no initial value"; h.reduce = h.foldl = h.inject = function (n, t, r, e) { null == n && (n = []), t = g(t, e, 4); var u, i = n.length !== +n.length && h.keys(n), a = (i || n).length, o = 0; if (arguments.length < 3) { if (!a) throw new TypeError(v); r = n[i ? i[o++] : o++] } for (; a > o; o++) u = i ? i[o] : o, r = t(r, n[u], u, n); return r }, h.reduceRight = h.foldr = function (n, t, r, e) { null == n && (n = []), t = g(t, e, 4); var u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; if (arguments.length < 3) { if (!a) throw new TypeError(v); r = n[i ? i[--a] : --a] } for (; a--;) u = i ? i[a] : a, r = t(r, n[u], u, n); return r }, h.find = h.detect = function (n, t, r) { var e; return t = h.iteratee(t, r), h.some(n, function (n, r, u) { return t(n, r, u) ? (e = n, !0) : void 0 }), e }, h.filter = h.select = function (n, t, r) { var e = []; return null == n ? e : (t = h.iteratee(t, r), h.each(n, function (n, r, u) { t(n, r, u) && e.push(n) }), e) }, h.reject = function (n, t, r) { return h.filter(n, h.negate(h.iteratee(t)), r) }, h.every = h.all = function (n, t, r) { if (null == n) return !0; t = h.iteratee(t, r); var e, u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; for (e = 0; a > e; e++) if (u = i ? i[e] : e, !t(n[u], u, n)) return !1; return !0 }, h.some = h.any = function (n, t, r) { if (null == n) return !1; t = h.iteratee(t, r); var e, u, i = n.length !== +n.length && h.keys(n), a = (i || n).length; for (e = 0; a > e; e++) if (u = i ? i[e] : e, t(n[u], u, n)) return !0; return !1 }, h.contains = h.include = function (n, t) { return null == n ? !1 : (n.length !== +n.length && (n = h.values(n)), h.indexOf(n, t) >= 0) }, h.invoke = function (n, t) { var r = a.call(arguments, 2), e = h.isFunction(t); return h.map(n, function (n) { return (e ? t : n[t]).apply(n, r) }) }, h.pluck = function (n, t) { return h.map(n, h.property(t)) }, h.where = function (n, t) { return h.filter(n, h.matches(t)) }, h.findWhere = function (n, t) { return h.find(n, h.matches(t)) }, h.max = function (n, t, r) { var e, u, i = -1 / 0, a = -1 / 0; if (null == t && null != n) { n = n.length === +n.length ? n : h.values(n); for (var o = 0, l = n.length; l > o; o++) e = n[o], e > i && (i = e) } else t = h.iteratee(t, r), h.each(n, function (n, r, e) { u = t(n, r, e), (u > a || u === -1 / 0 && i === -1 / 0) && (i = n, a = u) }); return i }, h.min = function (n, t, r) { var e, u, i = 1 / 0, a = 1 / 0; if (null == t && null != n) { n = n.length === +n.length ? n : h.values(n); for (var o = 0, l = n.length; l > o; o++) e = n[o], i > e && (i = e) } else t = h.iteratee(t, r), h.each(n, function (n, r, e) { u = t(n, r, e), (a > u || 1 / 0 === u && 1 / 0 === i) && (i = n, a = u) }); return i }, h.shuffle = function (n) { for (var t, r = n && n.length === +n.length ? n : h.values(n), e = r.length, u = Array(e), i = 0; e > i; i++) t = h.random(0, i), t !== i && (u[i] = u[t]), u[t] = r[i]; return u }, h.sample = function (n, t, r) { return null == t || r ? (n.length !== +n.length && (n = h.values(n)), n[h.random(n.length - 1)]) : h.shuffle(n).slice(0, Math.max(0, t)) }, h.sortBy = function (n, t, r) { return t = h.iteratee(t, r), h.pluck(h.map(n, function (n, r, e) { return { value: n, index: r, criteria: t(n, r, e) } }).sort(function (n, t) { var r = n.criteria, e = t.criteria; if (r !== e) { if (r > e || r === void 0) return 1; if (e > r || e === void 0) return -1 } return n.index - t.index }), "value") }; var m = function (n) { return function (t, r, e) { var u = {}; return r = h.iteratee(r, e), h.each(t, function (e, i) { var a = r(e, i, t); n(u, e, a) }), u } }; h.groupBy = m(function (n, t, r) { h.has(n, r) ? n[r].push(t) : n[r] = [t] }), h.indexBy = m(function (n, t, r) { n[r] = t }), h.countBy = m(function (n, t, r) { h.has(n, r) ? n[r]++ : n[r] = 1 }), h.sortedIndex = function (n, t, r, e) { r = h.iteratee(r, e, 1); for (var u = r(t), i = 0, a = n.length; a > i;) { var o = i + a >>> 1; r(n[o]) < u ? i = o + 1 : a = o } return i }, h.toArray = function (n) { return n ? h.isArray(n) ? a.call(n) : n.length === +n.length ? h.map(n, h.identity) : h.values(n) : [] }, h.size = function (n) { return null == n ? 0 : n.length === +n.length ? n.length : h.keys(n).length }, h.partition = function (n, t, r) { t = h.iteratee(t, r); var e = [], u = []; return h.each(n, function (n, r, i) { (t(n, r, i) ? e : u).push(n) }), [e, u] }, h.first = h.head = h.take = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[0] : 0 > t ? [] : a.call(n, 0, t) }, h.initial = function (n, t, r) { return a.call(n, 0, Math.max(0, n.length - (null == t || r ? 1 : t))) }, h.last = function (n, t, r) { return null == n ? void 0 : null == t || r ? n[n.length - 1] : a.call(n, Math.max(n.length - t, 0)) }, h.rest = h.tail = h.drop = function (n, t, r) { return a.call(n, null == t || r ? 1 : t) }, h.compact = function (n) { return h.filter(n, h.identity) }; var y = function (n, t, r, e) { if (t && h.every(n, h.isArray)) return o.apply(e, n); for (var u = 0, a = n.length; a > u; u++) { var l = n[u]; h.isArray(l) || h.isArguments(l) ? t ? i.apply(e, l) : y(l, t, r, e) : r || e.push(l) } return e }; h.flatten = function (n, t) { return y(n, t, !1, []) }, h.without = function (n) { return h.difference(n, a.call(arguments, 1)) }, h.uniq = h.unique = function (n, t, r, e) { if (null == n) return []; h.isBoolean(t) || (e = r, r = t, t = !1), null != r && (r = h.iteratee(r, e)); for (var u = [], i = [], a = 0, o = n.length; o > a; a++) { var l = n[a]; if (t) a && i === l || u.push(l), i = l; else if (r) { var c = r(l, a, n); h.indexOf(i, c) < 0 && (i.push(c), u.push(l)) } else h.indexOf(u, l) < 0 && u.push(l) } return u }, h.union = function () { return h.uniq(y(arguments, !0, !0, [])) }, h.intersection = function (n) { if (null == n) return []; for (var t = [], r = arguments.length, e = 0, u = n.length; u > e; e++) { var i = n[e]; if (!h.contains(t, i)) { for (var a = 1; r > a && h.contains(arguments[a], i) ; a++); a === r && t.push(i) } } return t }, h.difference = function (n) { var t = y(a.call(arguments, 1), !0, !0, []); return h.filter(n, function (n) { return !h.contains(t, n) }) }, h.zip = function (n) { if (null == n) return []; for (var t = h.max(arguments, "length").length, r = Array(t), e = 0; t > e; e++) r[e] = h.pluck(arguments, e); return r }, h.object = function (n, t) { if (null == n) return {}; for (var r = {}, e = 0, u = n.length; u > e; e++) t ? r[n[e]] = t[e] : r[n[e][0]] = n[e][1]; return r }, h.indexOf = function (n, t, r) { if (null == n) return -1; var e = 0, u = n.length; if (r) { if ("number" != typeof r) return e = h.sortedIndex(n, t), n[e] === t ? e : -1; e = 0 > r ? Math.max(0, u + r) : r } for (; u > e; e++) if (n[e] === t) return e; return -1 }, h.lastIndexOf = function (n, t, r) { if (null == n) return -1; var e = n.length; for ("number" == typeof r && (e = 0 > r ? e + r + 1 : Math.min(e, r + 1)) ; --e >= 0;) if (n[e] === t) return e; return -1 }, h.range = function (n, t, r) { arguments.length <= 1 && (t = n || 0, n = 0), r = r || 1; for (var e = Math.max(Math.ceil((t - n) / r), 0), u = Array(e), i = 0; e > i; i++, n += r) u[i] = n; return u }; var d = function () { }; h.bind = function (n, t) { var r, e; if (p && n.bind === p) return p.apply(n, a.call(arguments, 1)); if (!h.isFunction(n)) throw new TypeError("Bind must be called on a function"); return r = a.call(arguments, 2), e = function () { if (!(this instanceof e)) return n.apply(t, r.concat(a.call(arguments))); d.prototype = n.prototype; var u = new d; d.prototype = null; var i = n.apply(u, r.concat(a.call(arguments))); return h.isObject(i) ? i : u } }, h.partial = function (n) { var t = a.call(arguments, 1); return function () { for (var r = 0, e = t.slice(), u = 0, i = e.length; i > u; u++) e[u] === h && (e[u] = arguments[r++]); for (; r < arguments.length;) e.push(arguments[r++]); return n.apply(this, e) } }, h.bindAll = function (n) { var t, r, e = arguments.length; if (1 >= e) throw new Error("bindAll must be passed function names"); for (t = 1; e > t; t++) r = arguments[t], n[r] = h.bind(n[r], n); return n }, h.memoize = function (n, t) { var r = function (e) { var u = r.cache, i = t ? t.apply(this, arguments) : e; return h.has(u, i) || (u[i] = n.apply(this, arguments)), u[i] }; return r.cache = {}, r }, h.delay = function (n, t) { var r = a.call(arguments, 2); return setTimeout(function () { return n.apply(null, r) }, t) }, h.defer = function (n) { return h.delay.apply(h, [n, 1].concat(a.call(arguments, 1))) }, h.throttle = function (n, t, r) { var e, u, i, a = null, o = 0; r || (r = {}); var l = function () { o = r.leading === !1 ? 0 : h.now(), a = null, i = n.apply(e, u), a || (e = u = null) }; return function () { var c = h.now(); o || r.leading !== !1 || (o = c); var f = t - (c - o); return e = this, u = arguments, 0 >= f || f > t ? (clearTimeout(a), a = null, o = c, i = n.apply(e, u), a || (e = u = null)) : a || r.trailing === !1 || (a = setTimeout(l, f)), i } }, h.debounce = function (n, t, r) { var e, u, i, a, o, l = function () { var c = h.now() - a; t > c && c > 0 ? e = setTimeout(l, t - c) : (e = null, r || (o = n.apply(i, u), e || (i = u = null))) }; return function () { i = this, u = arguments, a = h.now(); var c = r && !e; return e || (e = setTimeout(l, t)), c && (o = n.apply(i, u), i = u = null), o } }, h.wrap = function (n, t) { return h.partial(t, n) }, h.negate = function (n) { return function () { return !n.apply(this, arguments) } }, h.compose = function () { var n = arguments, t = n.length - 1; return function () { for (var r = t, e = n[t].apply(this, arguments) ; r--;) e = n[r].call(this, e); return e } }, h.after = function (n, t) { return function () { return --n < 1 ? t.apply(this, arguments) : void 0 } }, h.before = function (n, t) { var r; return function () { return --n > 0 ? r = t.apply(this, arguments) : t = null, r } }, h.once = h.partial(h.before, 2), h.keys = function (n) { if (!h.isObject(n)) return []; if (s) return s(n); var t = []; for (var r in n) h.has(n, r) && t.push(r); return t }, h.values = function (n) { for (var t = h.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = n[t[u]]; return e }, h.pairs = function (n) { for (var t = h.keys(n), r = t.length, e = Array(r), u = 0; r > u; u++) e[u] = [t[u], n[t[u]]]; return e }, h.invert = function (n) { for (var t = {}, r = h.keys(n), e = 0, u = r.length; u > e; e++) t[n[r[e]]] = r[e]; return t }, h.functions = h.methods = function (n) { var t = []; for (var r in n) h.isFunction(n[r]) && t.push(r); return t.sort() }, h.extend = function (n) { if (!h.isObject(n)) return n; for (var t, r, e = 1, u = arguments.length; u > e; e++) { t = arguments[e]; for (r in t) c.call(t, r) && (n[r] = t[r]) } return n }, h.pick = function (n, t, r) { var e, u = {}; if (null == n) return u; if (h.isFunction(t)) { t = g(t, r); for (e in n) { var i = n[e]; t(i, e, n) && (u[e] = i) } } else { var l = o.apply([], a.call(arguments, 1)); n = new Object(n); for (var c = 0, f = l.length; f > c; c++) e = l[c], e in n && (u[e] = n[e]) } return u }, h.omit = function (n, t, r) { if (h.isFunction(t)) t = h.negate(t); else { var e = h.map(o.apply([], a.call(arguments, 1)), String); t = function (n, t) { return !h.contains(e, t) } } return h.pick(n, t, r) }, h.defaults = function (n) { if (!h.isObject(n)) return n; for (var t = 1, r = arguments.length; r > t; t++) { var e = arguments[t]; for (var u in e) n[u] === void 0 && (n[u] = e[u]) } return n }, h.clone = function (n) { return h.isObject(n) ? h.isArray(n) ? n.slice() : h.extend({}, n) : n }, h.tap = function (n, t) { return t(n), n }; var b = function (n, t, r, e) { if (n === t) return 0 !== n || 1 / n === 1 / t; if (null == n || null == t) return n === t; n instanceof h && (n = n._wrapped), t instanceof h && (t = t._wrapped); var u = l.call(n); if (u !== l.call(t)) return !1; switch (u) { case "[object RegExp]": case "[object String]": return "" + n == "" + t; case "[object Number]": return +n !== +n ? +t !== +t : 0 === +n ? 1 / +n === 1 / t : +n === +t; case "[object Date]": case "[object Boolean]": return +n === +t } if ("object" != typeof n || "object" != typeof t) return !1; for (var i = r.length; i--;) if (r[i] === n) return e[i] === t; var a = n.constructor, o = t.constructor; if (a !== o && "constructor" in n && "constructor" in t && !(h.isFunction(a) && a instanceof a && h.isFunction(o) && o instanceof o)) return !1; r.push(n), e.push(t); var c, f; if ("[object Array]" === u) { if (c = n.length, f = c === t.length) for (; c-- && (f = b(n[c], t[c], r, e)) ;); } else { var s, p = h.keys(n); if (c = p.length, f = h.keys(t).length === c) for (; c-- && (s = p[c], f = h.has(t, s) && b(n[s], t[s], r, e)) ;); } return r.pop(), e.pop(), f }; h.isEqual = function (n, t) { return b(n, t, [], []) }, h.isEmpty = function (n) { if (null == n) return !0; if (h.isArray(n) || h.isString(n) || h.isArguments(n)) return 0 === n.length; for (var t in n) if (h.has(n, t)) return !1; return !0 }, h.isElement = function (n) { return !(!n || 1 !== n.nodeType) }, h.isArray = f || function (n) { return "[object Array]" === l.call(n) }, h.isObject = function (n) { var t = typeof n; return "function" === t || "object" === t && !!n }, h.each(["Arguments", "Function", "String", "Number", "Date", "RegExp"], function (n) { h["is" + n] = function (t) { return l.call(t) === "[object " + n + "]" } }), h.isArguments(arguments) || (h.isArguments = function (n) { return h.has(n, "callee") }), "function" != typeof /./ && (h.isFunction = function (n) { return "function" == typeof n || !1 }), h.isFinite = function (n) { return isFinite(n) && !isNaN(parseFloat(n)) }, h.isNaN = function (n) { return h.isNumber(n) && n !== +n }, h.isBoolean = function (n) { return n === !0 || n === !1 || "[object Boolean]" === l.call(n) }, h.isNull = function (n) { return null === n }, h.isUndefined = function (n) { return n === void 0 }, h.has = function (n, t) { return null != n && c.call(n, t) }, h.noConflict = function () { return n._ = t, this }, h.identity = function (n) { return n }, h.constant = function (n) { return function () { return n } }, h.noop = function () { }, h.property = function (n) { return function (t) { return t[n] } }, h.matches = function (n) { var t = h.pairs(n), r = t.length; return function (n) { if (null == n) return !r; n = new Object(n); for (var e = 0; r > e; e++) { var u = t[e], i = u[0]; if (u[1] !== n[i] || !(i in n)) return !1 } return !0 } }, h.times = function (n, t, r) { var e = Array(Math.max(0, n)); t = g(t, r, 1); for (var u = 0; n > u; u++) e[u] = t(u); return e }, h.random = function (n, t) { return null == t && (t = n, n = 0), n + Math.floor(Math.random() * (t - n + 1)) }, h.now = Date.now || function () { return (new Date).getTime() }; var _ = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }, w = h.invert(_), j = function (n) { var t = function (t) { return n[t] }, r = "(?:" + h.keys(n).join("|") + ")", e = RegExp(r), u = RegExp(r, "g"); return function (n) { return n = null == n ? "" : "" + n, e.test(n) ? n.replace(u, t) : n } }; h.escape = j(_), h.unescape = j(w), h.result = function (n, t) { if (null == n) return void 0; var r = n[t]; return h.isFunction(r) ? n[t]() : r }; var x = 0; h.uniqueId = function (n) { var t = ++x + ""; return n ? n + t : t }, h.templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }; var A = /(.)^/, k = { "'": "'", "\\": "\\", "\r": "r", "\n": "n", "\u2028": "u2028", "\u2029": "u2029" }, O = /\\|'|\r|\n|\u2028|\u2029/g, F = function (n) { return "\\" + k[n] }; h.template = function (n, t, r) { !t && r && (t = r), t = h.defaults({}, t, h.templateSettings); var e = RegExp([(t.escape || A).source, (t.interpolate || A).source, (t.evaluate || A).source].join("|") + "|$", "g"), u = 0, i = "__p+='"; n.replace(e, function (t, r, e, a, o) { return i += n.slice(u, o).replace(O, F), u = o + t.length, r ? i += "'+\n((__t=(" + r + "))==null?'':_.escape(__t))+\n'" : e ? i += "'+\n((__t=(" + e + "))==null?'':__t)+\n'" : a && (i += "';\n" + a + "\n__p+='"), t }), i += "';\n", t.variable || (i = "with(obj||{}){\n" + i + "}\n"), i = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + i + "return __p;\n"; try { var a = new Function(t.variable || "obj", "_", i) } catch (o) { throw o.source = i, o } var l = function (n) { return a.call(this, n, h) }, c = t.variable || "obj"; return l.source = "function(" + c + "){\n" + i + "}", l }, h.chain = function (n) { var t = h(n); return t._chain = !0, t }; var E = function (n) { return this._chain ? h(n).chain() : n }; h.mixin = function (n) { h.each(h.functions(n), function (t) { var r = h[t] = n[t]; h.prototype[t] = function () { var n = [this._wrapped]; return i.apply(n, arguments), E.call(this, r.apply(h, n)) } }) }, h.mixin(h), h.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (n) { var t = r[n]; h.prototype[n] = function () { var r = this._wrapped; return t.apply(r, arguments), "shift" !== n && "splice" !== n || 0 !== r.length || delete r[0], E.call(this, r) } }), h.each(["concat", "join", "slice"], function (n) { var t = r[n]; h.prototype[n] = function () { return E.call(this, t.apply(this._wrapped, arguments)) } }), h.prototype.value = function () { return this._wrapped }, "function" == typeof define && define.amd && define("underscore", [], function () { return h }) }).call(this);
//# sourceMappingURL=underscore-min.map
_EnsureJSClass('iGuid');
(function () {
function iGuid(guid) {
if (!guid) throw new TypeError("Invalid argument; `value` has no value.");
this.value = iGuid.EMPTY;
if (guid && guid instanceof iGuid) {
this.value = iGuid.toString();
} else if (guid && Object.prototype.toString.call(guid) === "[object String]" && iGuid.isGuid(guid)) {
this.value = guid;
}
this.equals = function (other) {
// Comparing string `value` against provided `guid` will auto-call
// toString on `guid` for comparison
return iGuid.isGuid(other) && this.value == other;
};
this.isEmpty = function () {
return this.value === iGuid.EMPTY;
};
this.toString = function () {
return this.value;
};
this.toJSON = function () {
return this.value;
};
};
iGuid.EMPTY = "00000000-0000-0000-0000-000000000000";
iGuid.isGuid = function (value) {
return value && (value instanceof iGuid || iGuid.validator.test(value.toString()));
};
iGuid.create = function () {
return new iGuid([iGuid.gen(2), iGuid.gen(1), iGuid.gen(1), iGuid.gen(1), iGuid.gen(3)].join("-"));
};
iGuid.raw = function () {
return [iGuid.gen(2), iGuid.gen(1), iGuid.gen(1), iGuid.gen(1), iGuid.gen(3)].join("-");
};
iGuid.gen = function (count) {
var out = "";
for (var i = 0; i < count; i++) {
out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return out;
}
iGuid.validator = new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$", "i");
if (typeof module != 'undefined' && module.exports) {
module.exports = iGuid;
}
else if (typeof iVision != 'undefined') {
iVision.iGuid = iGuid;
}
else if (typeof window != 'undefined') {
window.iGuid = iGuid;
}
})();
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionUtilities');
/*!
* Script Name: iVisionjQCountHighlight
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
_EnsureJSClass('iVision.countHighlight');
// Just in case
jQuery.noConflict();
(function ($, window, document, undefined) {
//"use strict";
var highlight = {
registered: false,
waypoints: []
};
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(this).data('speed'),
refreshInterval: $(this).data('refresh-interval'),
decimals: $(this).data('decimals')
}, options);
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(settings.speed / settings.refreshInterval),
increment = (settings.to - settings.from) / loops;
// references & variables that will change with each update
var self = this,
$self = $(this),
loopCount = 0,
value = settings.from,
data = $self.data('countTo') || {};
$self.data('countTo', data);
// if an existing interval can be found, clear it first
if (data.interval) {
clearInterval(data.interval);
}
data.interval = setInterval(updateTimer, settings.refreshInterval);
// initialize the element with the starting value
render(value);
function updateTimer() {
value += increment;
loopCount++;
render(value);
if (typeof (settings.onUpdate) == 'function') {
settings.onUpdate.call(self, value);
}
if (loopCount >= loops) {
// remove the interval
$self.removeData('countTo');
clearInterval(data.interval);
value = settings.to;
if (typeof (settings.onComplete) == 'function') {
settings.onComplete.call(self, value);
}
}
}
function render(value) {
var formattedValue = settings.formatter.call(self, value, settings);
$self.text(formattedValue);
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 0, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
formatter: formatter, // handler for formatting the value before rendering
onUpdate: null, // callback method for every time the element is updated
onComplete: null // callback method for when the element finishes updating
};
function formatter(value, settings) {
return value.toFixed(settings.decimals);
}
iVision.countHighlight = function () {
// Add Symbol
$('.milestone').each(function () {
if ($(this).has('[data-symbol]')) {
if ($(this).attr('data-symbol-pos') == 'before') {
$(this).find('.number').prepend($(this).attr('data-symbol'));
} else {
$(this).find('.number').append($(this).attr('data-symbol'));
}
}
});
// Waypoints
$('.milestone').each(function () {
var elem = $(this),
milestoneWaypoint = new Waypoint({
element: elem,
// onPreInit: function(theWayPoint) {
// theWayPoint.context = iVision.getWorkspace();
// },
context: iVision.getWorkspace(),
handler: function (direction) {
elem.find('.number span').countTo({
from: 0,
// to: parseInt($(this.element).find('.number span').text(), 10),
speed: 1500,
refreshInterval: 30
});
this.destroy();
},
offset: '75%'
});
highlight.waypoints.push(milestoneWaypoint);
});
}; /*** END Milestones ***/
iVision.countHighlight();
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQCountHighlight');
})(jQuery, window, document);
/**
* Script Name: iVisionjQCountTo
*
* @author Travis Smith <[email protected]>
* @link https://github.com/mhuggins/jquery-countTo
*/
(function ($, window, document, undefined) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(this).data('speed'),
refreshInterval: $(this).data('refresh-interval'),
decimals: $(this).data('decimals')
}, options);
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(settings.speed / settings.refreshInterval),
increment = (settings.to - settings.from) / loops;
// references & variables that will change with each update
var self = this,
$self = $(this),
loopCount = 0,
value = settings.from,
data = $self.data('countTo') || {};
$self.data('countTo', data);
// if an existing interval can be found, clear it first
if (data.interval) {
clearInterval(data.interval);
}
data.interval = setInterval(updateTimer, settings.refreshInterval);
// initialize the element with the starting value
render(value);
function updateTimer() {
value += increment;
loopCount++;
render(value);
if (typeof (settings.onUpdate) == 'function') {
settings.onUpdate.call(self, value);
}
if (loopCount >= loops) {
// remove the interval
$self.removeData('countTo');
clearInterval(data.interval);
value = settings.to;
if (typeof (settings.onComplete) == 'function') {
settings.onComplete.call(self, value);
}
}
}
function render(value) {
var formattedValue = settings.formatter.call(self, value, settings);
$self.text(formattedValue);
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 0, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
formatter: formatter, // handler for formatting the value before rendering
onUpdate: null, // callback method for every time the element is updated
onComplete: null // callback method for when the element finishes updating
};
function formatter(value, settings) {
return value.toFixed(settings.decimals);
}
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQCountTo');
//console.log('iVisionCountTo loaded');
})(jQuery, window, document)
/*!
* Script Name: iVisionjQDepartment
* Department AGG JS
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
// Run in noConflict mode
jQuery.noConflict();
(function ($, window, document, undefined) {
iVision.department = iVision.department || {};
iVision.department.init = function () {
// Go!
iVision.department.navbar();
//SP.SOD.loadMultiple(['iVisionBootstrap', 'iVisionjQSinglePageNav', 'iVisionjQSPWaypoints'], iVision.sidebarNav);
};
iVision.department.registered = false;
iVision.department.register = function () {
if (!iVision.department.registered) {
// Register jQueryTaxonomyNavigation
iVision.scripts.add('iVisionjQTaxonomyNavigation', '/_layouts/15/AGGSP/assets/js/jquery.taxonomyNavigation.js', 'iVisionjQuery');
iVision.department.registered = true;
}
};
iVision.department.navbar = function () {
iVision.navbarAffix('#department-navbar');
};
iVision.department.setHeaderLocation = function () {
var headerContainer = $('.section-header.header-image'),
siteWidth = $(window).width(),
imgWidth = headerContainer.width(),
containerWidth = $('.container').width(),
ratio = imgWidth / siteWidth,
leftWidth = ((siteWidth - containerWidth) / 2) * ratio;
headerContainer.find('.page-header').css({
'max-width': containerWidth,
'left': leftWidth
}).show();
}
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionDepartment');
})(jQuery, window, document, undefined);
// Fire within SharePoint
jQuery(document).on("SPReady", function () {
iVision.department.init();
});
/*!
* Script Name: iVisionGlobal
* Global AGG JS
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
iVision.global = {};
// Run in noConflict mode
jQuery.noConflict();
(function ($, window, document, undefined) {
//"use strict";
iVision.waypoints = [];
iVision.global.init = function () {
// Register scripts & dependencies
iVision.global.register();
// Format year when Moment is loaded!
SP.SOD.executeFunc('iVisionMoment', null, iVision.global.formatYear);
// Go!
iVision.global.smoothScroll();
iVision.global.mobileMenu();
};
iVision.global.registered = false;
iVision.global.register = function () {
if (!iVision.global.registered) {
// Register CountTo
iVision.scripts.add('iVisionjQCountTo', '/_layouts/15/AGGSP/assets/js/jquery.countTo.js', 'iVisionjQuery');
iVision.global.registered = true;
}
};
//@todo Maybe needs fixing
// Mobile menu
iVision.global.mobileMenu = function () {
$(".navbar-collapse li").click(function (event) {
if ($(iVision.getWorkspace()).width() > 991) {
window.location.href = event.target.href;
return;
}
$(this).find(".dropdown-menu:first").slideToggle(function () {
$(this).parent().toggleClass("menu-open");
});
});
};
// Navigation
iVision.navbarAffix = function (selector, offset) {
// Fix scrolling spy
$(iVision.getWorkspace()).on('scroll', function () { $(document).trigger('scroll'); });
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if ("1" !== inDesignMode) {
offset = 'undefined' === typeof offset ? 0 : offset;
var options = {
target: iVision.getWorkspace()
};
if (!$('#suiteBar .ms-siteactions-normal') && !$('html').hasClass('_layouts-section') && !$('html').hasClass('lists-section')) {
if (0 === offset) {
options.offset = { top: ('#topbar').outerHeight() };
}
$(selector).affix(options);
}
if (0 !== offset) {
options.offset = { top: offset };
}
$(selector).affix(options);
}
};
// @todo Needs Fixing
// Smooth Hash Link Scroll
iVision.global.smoothScroll = function () {
// Smooth Hash Link Scroll
$('.smooth-scroll').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$(iVision.getWorkspace()).animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
};
iVision.global.formatYear = function () {
$('.year').text(moment().format('YYYY'));
};
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionGlobal');
})(jQuery, window, document, undefined);
// Fire within SharePoint
//_spBodyOnLoadFunctionNames.push("iVision.global");
jQuery(document).on("SPReady", function () {
iVision.global.init();
// ExecuteOrDelayUntilScriptLoaded(iVision.global, "iVisionHeadJS");
});
/*!
* Script Name: iVisionjQMain
* Main AGG JS
* @author Travis Smith <[email protected]>
*/
var iVision = iVision || {};
// jQuery should be already running in noConflict mode from jquery.global.js
jQuery.noConflict();
(function ($, window, document, undefined) {
//"use strict";
iVision.main = iVision.main || {};
iVision.main.registered = false;
iVision.main.init = function () {
// Register scripts & dependencies
iVision.main.register();
// Format year when Moment is loaded!
SP.SOD.executeFunc('iVisionMoment', null, iVision.main.formatYear);
SP.SOD.executeFunc('iVisionBootstrap', null, iVision.main.carousel);
// Go!
iVision.main.parallax(); // Depends on jQuery
iVision.main.scrollToTop(); // Depends on jQuery
// iVision.sidebarNav() Depends on jQuery, Bootstrap, SinglePageNav, WayPoints
iVision.main.sidebarNav();
iVision.main.navbar();
};
// Load CountTo jQuery Plugin
iVision.main.register = function () {
if (!iVision.registered) {
// Register CountTo
iVision.scripts.add('iVisionjQCountTo', '/_layouts/15/AGGSP/assets/js/jquery.countTo.js', 'iVisionjQuery');
iVision.registered = true;
}
};
// Format Copyright
iVision.main.formatYear = function () {
$('.year').text(moment().format('YYYY'));
};
iVision.main.carousel = function () {
$('.bootstrap-carousel').carousel({
interval: 500
});
};
// Parallax Sections
iVision.main.parallax = function () {
$('section[data-type="background"]').each(function () {
// declare the variable to affect the defined data-type
var $scroll = $(this),
height = $scroll.height();
// Get scrollable area
var $w = $(iVision.getWorkspace());
// On scroll...
$(iVision.getWorkspace()).scroll(function () {
// HTML5 proves useful for helping with creating JS functions!
// also, negative value because we're scrolling upwards
// var yPos = -($w.scrollTop() / $scroll.data('speed'));
var yPos = -Math.floor($w.scrollTop() / $scroll.data('speed'));
// background position
var coords = '50% ' + yPos + 'px';
// move the background
$scroll.css({ backgroundPosition: coords });
}); // end window scroll
}); // end section function
}; /*** END Parallax Sections ***/
/*** Smooth Scroll to Top ***/
iVision.main.scrollToTop = function () {
// Add "loaded" class when a section has been loaded
$(iVision.getWorkspace()).scroll(function () {
//var scrollTop = $(window).scrollTop();
var scrollTop = iVision.GetWindowScrollPosition().y;
$(".section").each(function () {
var elementTop = $(this).offset().top - $('#header').outerHeight();
if (scrollTop >= elementTop) {
$(this).addClass('loaded');
}
});
});
}; /*** END Smooth Scroll to Top ***/
// Navigation
iVision.main.navbar = function () {
iVision.navbarAffix('#navbar');
// Prevent snapping
$('.navbar-nav a').click(function (e) {
if ('#' === $(this).attr('href')) {
e.preventDefault();
}
});
};
/*** Single Page Navigation - Sidebar ***/
iVision.main.sidebarNav = function () {
// Sidebar / Navigation
iVision.navbarAffix('#sidebar', 660);
// Create single page nav
var singlePageNavOptions = {
offset: $('#navbar').outerHeight(),
filter: ':not(.external)',
speed: 750,
updateHash: true,
//currentClass: 'active',
beforeStart: function () {
},
onComplete: function () {
}
};
$('#sidebar').singlePageNav(singlePageNavOptions);
// Animate sidebar single page nav
$('#sidebar').hover(function () {
$(this).animate({ left: '0px' }, { queue: false, duration: 500 });
}, function () {
$(this).animate({ left: '-110px' }, { queue: false, duration: 500 });
});
// Sidebar Navigation appearance
var waypoint = new Waypoint({
element: $('#firm'),
context: iVision.getWorkspace(),
handler: function (direction) {
if ('down' === direction) {
$('#sidebar-menu').fadeIn();
} else {
$('#sidebar-menu').fadeOut();
}
}
});
iVision.waypoints.push(waypoint);
}; /*** END Single Page Navigation ***/
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQMain');
})(jQuery, window, document, undefined);
// Fire within SharePoint
//_spBodyOnLoadFunctionNames.push("iVision.main");
jQuery(document).on("SPReady", function () {
iVision.main.init();
});
/**
* Single Page Nav Plugin
* Copyright (c) 2013 Chris Wojcik <[email protected]>
* Dual licensed under MIT and GPL.
* @author Chris Wojcik
* @author Travis Smith (SharePoint Changes) <[email protected]>
* @version 2.0.0 (based on 1.1.0)
*/
// Utility
if (typeof Object.create !== 'function') {
Object.create = function (obj) {
function F() { }
F.prototype = obj;
return new F();
};
}
(function ($, window, document, undefined) {
"use strict";
var SinglePageNav = {
init: function (options, container) {
this.options = $.extend({}, $.fn.singlePageNav.defaults, options);
this.container = container;
this.$container = $(container);
this.$links = this.$container.find('a');
if (this.options.filter !== '') {
this.$links = this.$links.filter(this.options.filter);
}
//this.$window = $(window);
this.$window = $(iVision.getWorkspace());
this.$htmlbody = $(iVision.getWorkspace());
//this.$htmlbody = $(iVision.getBody());
this.$links.on('click.singlePageNav', $.proxy(this.handleClick, this));
this.didScroll = false;
this.checkPosition();
this.setTimer();
},
handleClick: function (e) {
var self = this,
link = e.currentTarget,
$elem = $(link.hash);
e.preventDefault();
if ($elem.length) { // Make sure the target elem exists
// Prevent active link from cycling during the scroll
self.clearTimer();
// Before scrolling starts
if (typeof self.options.beforeStart === 'function') {
self.options.beforeStart();
}
self.setActiveLink(link.hash);
self.scrollTo($elem, function () {
if (self.options.updateHash) {
document.location.hash = link.hash;
}
self.setTimer();
// After scrolling ends
if (typeof self.options.onComplete === 'function') {
self.options.onComplete();
}
});
}
},
scrollTo: function ($elem, callback) {
var self = this;
var target = self.getCoords($elem).top;
var called = false;
self.$htmlbody.stop().animate(
{ scrollTop: target },
{
duration: self.options.speed,
complete: function () {
if (typeof callback === 'function' && !called) {
callback();
}
called = true;
}
}
);
},
setTimer: function () {
var self = this;
self.$window.on('scroll.singlePageNav', function () {
self.didScroll = true;
});
self.timer = setInterval(function () {
if (self.didScroll) {
self.didScroll = false;
self.checkPosition();
}
}, 250);
},
clearTimer: function () {
clearInterval(this.timer);
this.$window.off('scroll.singlePageNav');
this.didScroll = false;
},
// Check the scroll position and set the active section
checkPosition: function () {
//var scrollPos = this.$window.scrollTop();
var scrollPos = iVision.GetWindowScrollPosition().y;
var currentSection = this.getCurrentSection(scrollPos);
this.setActiveLink(currentSection);
},
getCoords: function ($elem) {
return {
top: Math.round($elem.offset().top) - this.options.offset
};
},
setActiveLink: function (href) {
var $activeLink = this.$container.find("a[href='" + href + "']");
var $parent = $activeLink.parent();
this.$container.find('.' + this.options.currentClass).removeClass(this.options.currentClass);
$parent.addClass(this.options.currentClass);
},
getCurrentSection: function (scrollPos) {
var i, hash, coords, section;
for (i = 0; i < this.$links.length; i++) {
hash = this.$links[i].hash;
if ($(hash).length) {
coords = this.getCoords($(hash));
if (scrollPos >= (coords.top + this.options.threshold)) {
section = hash;
}
}
}
// The current section or the first link
return section || this.$links[0].hash;
}
};
iVision.SinglePageNav = SinglePageNav;
$.fn.singlePageNav = function (options) {
return this.each(function () {
var singlePageNav = Object.create(SinglePageNav);
singlePageNav.init(options, this);
});
};
$.fn.singlePageNav.defaults = {
offset: 0,
threshold: 120,
speed: 400,
currentClass: 'current',
updateHash: false,
filter: '',
onComplete: false,
beforeStart: false
};
})(jQuery, window, document);
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQSinglePageNav');
/*!
Script Name: iVisionjQSPWaypoints
Waypoints - 3.1.1
SharePoint Changes by Travis Smith (WPSMITH) <[email protected]>
Copyright © 2011-2015 Caleb Troughton
Licensed under the MIT license.
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
*/
(function () {
'use strict'
var keyCounter = 0
var allWaypoints = {}
/* http://imakewebthings.com/waypoints/api/waypoint */
function Waypoint(options) {
if (!options) {
throw new Error('No options passed to Waypoint constructor')
}
if (!options.element) {
throw new Error('No element option passed to Waypoint constructor')
}
if (!options.handler) {
throw new Error('No handler option passed to Waypoint constructor')
}
this.key = 'waypoint-' + keyCounter
this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)
// Added by WPSMITH
if ('function' === typeof options.onPreInit) {
options.onPreInit(this);
}
this.element = this.options.element
this.adapter = new Waypoint.Adapter(this.element)
this.callback = this.options.handler
this.axis = this.options.horizontal ? 'horizontal' : 'vertical'
this.enabled = this.options.enabled
this.triggerPoint = this.options.triggerPoint
this.group = Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context = Waypoint.Context.findOrCreateByElement(this.options.context)
if (Waypoint.offsetAliases[this.options.offset]) {
this.options.offset = Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
// Added by WPSMITH
if ('function' === typeof options.onInit) {
options.onInit(this);
}
allWaypoints[this.key] = this
keyCounter += 1
}
/* Private */
Waypoint.prototype.queueTrigger = function (direction) {
this.group.queueTrigger(this, direction)
}
/* Private */
Waypoint.prototype.trigger = function (args) {
if (!this.enabled) {
return
}
if (this.callback) {
this.callback.apply(this, args)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy */
Waypoint.prototype.destroy = function () {
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable */
Waypoint.prototype.disable = function () {
this.enabled = false
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable */
Waypoint.prototype.enable = function () {
this.context.refresh()
this.enabled = true
return this
}
/* Public */
/* http://imakewebthings.com/waypoints/api/next */
Waypoint.prototype.next = function () {
return this.group.next(this)
}
/* Public */
/* http://imakewebthings.com/waypoints/api/previous */
Waypoint.prototype.previous = function () {
return this.group.previous(this)
}
/* Private */
Waypoint.invokeAll = function (method) {
var allWaypointsArray = []
for (var waypointKey in allWaypoints) {
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i = 0, end = allWaypointsArray.length; i < end; i++) {
allWaypointsArray[i][method]()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/destroy-all */
Waypoint.destroyAll = function () {
Waypoint.invokeAll('destroy')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/disable-all */
Waypoint.disableAll = function () {
Waypoint.invokeAll('disable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/enable-all */
Waypoint.enableAll = function () {
Waypoint.invokeAll('enable')
}
/* Public */
/* http://imakewebthings.com/waypoints/api/refresh-all */
Waypoint.refreshAll = function () {
Waypoint.Context.refreshAll()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-height */
Waypoint.viewportHeight = function () {
return window.innerHeight || document.documentElement.clientHeight
}
/* Public */
/* http://imakewebthings.com/waypoints/api/viewport-width */
Waypoint.viewportWidth = function () {
return document.documentElement.clientWidth
}
Waypoint.adapters = []
Waypoint.defaults = {
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0,
// Added by WPSMITH
triggerPoint: null,
onPreInit: null,
onInit: null
}
Waypoint.offsetAliases = {
'bottom-in-view': function () {
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function () {
return this.context.innerWidth() - this.adapter.outerWidth()
}
}
window.Waypoint = Waypoint
}())
; (function () {
'use strict'
function requestAnimationFrameShim(callback) {
window.setTimeout(callback, 1000 / 60)
}
var keyCounter = 0
var contexts = {}
var Waypoint = window.Waypoint
var oldWindowLoad = window.onload
/* http://imakewebthings.com/waypoints/api/context */
function Context(element) {
this.element = element
this.Adapter = Waypoint.Adapter
this.adapter = new this.Adapter(element)
this.key = 'waypoint-context-' + keyCounter
this.didScroll = false
this.didResize = false
this.oldScroll = {
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints = {
vertical: {},
horizontal: {}
}
element.waypointContextKey = this.key
contexts[element.waypointContextKey] = this
keyCounter += 1
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
/* Private */
Context.prototype.add = function (waypoint) {
var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'
this.waypoints[axis][waypoint.key] = waypoint
this.refresh()
}
/* Private */
Context.prototype.checkEmpty = function () {
var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)
if (horizontalEmpty && verticalEmpty) {
this.adapter.off('.waypoints')
delete contexts[this.key]
}
}
/* Private */
Context.prototype.createThrottledResizeHandler = function () {
var self = this
function resizeHandler() {
self.handleResize()
self.didResize = false
}
this.adapter.on('resize.waypoints', function () {
if (!self.didResize) {
self.didResize = true
Waypoint.requestAnimationFrame(resizeHandler)
}
})
}
/* Private */
Context.prototype.createThrottledScrollHandler = function () {
var self = this
function scrollHandler() {
self.handleScroll()
self.didScroll = false
}
this.adapter.on('scroll.waypoints', function () {
if (!self.didScroll || Waypoint.isTouch) {
self.didScroll = true
Waypoint.requestAnimationFrame(scrollHandler)
}
})
}
/* Private */
Context.prototype.handleResize = function () {
Waypoint.Context.refreshAll()
}
/* Private */
Context.prototype.handleScroll = function () {
var triggeredGroups = {}
var axes = {
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
var isForward = axis.newScroll > axis.oldScroll
var direction = isForward ? axis.forward : axis.backward
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint
if (crossedForward || crossedBackward) {
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll = {
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}
}
/* Private */
Context.prototype.innerHeight = function () {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportHeight()
}
/*eslint-enable eqeqeq */
return this.adapter.innerHeight()
}
/* Private */
Context.prototype.remove = function (waypoint) {
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
/* Private */
Context.prototype.innerWidth = function () {
/*eslint-disable eqeqeq */
if (this.element == this.element.window) {
return Waypoint.viewportWidth()
}
/*eslint-enable eqeqeq */
return this.adapter.innerWidth()
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-destroy */
Context.prototype.destroy = function () {
var allWaypoints = []
for (var axis in this.waypoints) {
for (var waypointKey in this.waypoints[axis]) {
allWaypoints.push(this.waypoints[axis][waypointKey])
}
}
for (var i = 0, end = allWaypoints.length; i < end; i++) {
allWaypoints[i].destroy()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-refresh */
Context.prototype.refresh = function () {
/*eslint-disable eqeqeq */
var isWindow = this.element == this.element.window
/*eslint-enable eqeqeq */
var contextOffset = this.adapter.offset()
var triggeredGroups = {}
var axes
this.handleScroll()
//console.log('this')
//console.log(this)
axes = {
horizontal: {
contextOffset: isWindow ? 0 : contextOffset.left,
contextScroll: isWindow ? 0 : this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0 : contextOffset.top,
contextScroll: isWindow ? 0 : this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}
}
for (var axisKey in axes) {
var axis = axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]) {
var waypoint = this.waypoints[axisKey][waypointKey]
var adjustment = waypoint.options.offset
var oldTriggerPoint = waypoint.triggerPoint
var elementOffset = 0
var freshWaypoint = oldTriggerPoint == null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
//console.log('waypoint.element');
//console.log(waypoint.element);
//console.log('waypoint.element.window');
//console.log(waypoint.element.window);
//console.log('waypoint.element !== waypoint.element.window => '+waypoint.element !== waypoint.element.window);
if (waypoint.element !== waypoint.element.window) {
//console.log('waypoint.adapter.offset()[axis.offsetProp]')
//console.log(waypoint.adapter.offset()[axis.offsetProp])
elementOffset = waypoint.adapter.offset()[axis.offsetProp]
}
if (typeof adjustment === 'function') { //console.log('adjustment is a function'); //console.log(adjustment);
adjustment = adjustment.apply(waypoint)
}
else if (typeof adjustment === 'string') { //console.log('adjustment is a string'); //console.log(adjustment);
adjustment = parseFloat(adjustment)
if (waypoint.options.offset.indexOf('%') > -1) {
adjustment = Math.ceil(axis.contextDimension * adjustment / 100)
}
}
//console.log('axis');
//console.log(axis);
//console.log('axis.contextScroll');
//console.log(axis.contextScroll);
//console.log('axis.contextOffset');
//console.log(axis.contextOffset);
//console.log('elementOffset');
//console.log(elementOffset);
//console.log('contextModifier');
//console.log(axis.contextScroll - axis.contextOffset);
//console.log('adjustment');
//console.log(adjustment);
//console.log('oldTriggerPoint');
//console.log(oldTriggerPoint);
contextModifier = axis.contextScroll - axis.contextOffset
waypoint.triggerPoint = elementOffset + contextModifier - adjustment
//console.log("waypoint.triggerPoint");
//console.log("elementOffset + contextModifier - adjustment");
//console.log(elementOffset + contextModifier - adjustment);
//console.log(waypoint.triggerPoint);
wasBeforeScroll = oldTriggerPoint < axis.oldScroll
nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll
triggeredBackward = wasBeforeScroll && nowAfterScroll
triggeredForward = !wasBeforeScroll && !nowAfterScroll
if (!freshWaypoint && triggeredBackward) {
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (!freshWaypoint && triggeredForward) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id] = waypoint.group
}
}
}
for (var groupKey in triggeredGroups) {
triggeredGroups[groupKey].flushTriggers()
}
return this
}
/* Private */
Context.findOrCreateByElement = function (element) {
return Context.findByElement(element) || new Context(element)
}
/* Private */
Context.refreshAll = function () {
for (var contextId in contexts) {
contexts[contextId].refresh()
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/context-find-by-element */
Context.findByElement = function (element) {
return contexts[element.waypointContextKey]
}
window.onload = function () {
if (oldWindowLoad) {
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame = function (callback) {
var requestFn = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context = Context
}())
; (function () {
'use strict'
function byTriggerPoint(a, b) {
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b) {
return b.triggerPoint - a.triggerPoint
}
var groups = {
vertical: {},
horizontal: {}
}
var Waypoint = window.Waypoint
/* http://imakewebthings.com/waypoints/api/group */
function Group(options) {
this.name = options.name
this.axis = options.axis
this.id = this.name + '-' + this.axis
this.waypoints = []
this.clearTriggerQueues()
groups[this.axis][this.name] = this
}
/* Private */
Group.prototype.add = function (waypoint) {
this.waypoints.push(waypoint)
}
/* Private */
Group.prototype.clearTriggerQueues = function () {
this.triggerQueues = {
up: [],
down: [],
left: [],
right: []
}
}
/* Private */
Group.prototype.flushTriggers = function () {
for (var direction in this.triggerQueues) {
var waypoints = this.triggerQueues[direction]
var reverse = direction === 'up' || direction === 'left'
waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)
for (var i = 0, end = waypoints.length; i < end; i += 1) {
var waypoint = waypoints[i]
if (waypoint.options.continuous || i === waypoints.length - 1) {
waypoint.trigger([direction])
}
}
}
this.clearTriggerQueues()
}
/* Private */
Group.prototype.next = function (waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast = index === this.waypoints.length - 1
return isLast ? null : this.waypoints[index + 1]
}
/* Private */
Group.prototype.previous = function (waypoint) {
this.waypoints.sort(byTriggerPoint)
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1] : null
}
/* Private */
Group.prototype.queueTrigger = function (waypoint, direction) {
this.triggerQueues[direction].push(waypoint)
}
/* Private */
Group.prototype.remove = function (waypoint) {
var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)
if (index > -1) {
this.waypoints.splice(index, 1)
}
}
/* Public */
/* http://imakewebthings.com/waypoints/api/first */
Group.prototype.first = function () {
return this.waypoints[0]
}
/* Public */
/* http://imakewebthings.com/waypoints/api/last */
Group.prototype.last = function () {
return this.waypoints[this.waypoints.length - 1]
}
/* Private */
Group.findOrCreate = function (options) {
return groups[options.axis][options.name] || new Group(options)
}
Waypoint.Group = Group
}())
; (function () {
'use strict'
var $ = window.jQuery
var Waypoint = window.Waypoint
function JQueryAdapter(element) {
this.$element = $(element)
}
$.each([
'innerHeight',
'innerWidth',
'off',
'offset',
'on',
'outerHeight',
'outerWidth'
// ,
// 'scrollLeft',
// 'scrollTop'
], function (i, method) {
JQueryAdapter.prototype[method] = function () {
var args = Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}
})
/* Private */
JQueryAdapter.prototype.GetWindowScrollPosition = function () {
var scrOfX = 0;
var scrOfY = 0;
var workspace = document.getElementById("s4-workspace");
if (workspace != null) {
scrOfY = workspace.scrollTop;
scrOfX = workspace.scrollLeft;
}
else {
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
}
if (IsNullOrUndefined(scrOfY))
scrOfY = 0;
if (IsNullOrUndefined(scrOfX))
scrOfX = 0;
return {
x: scrOfX,
y: scrOfY
};
}
$.each([
'extend',
'inArray',
'isEmptyObject'
], function (i, method) {
JQueryAdapter[method] = $[method]
})
JQueryAdapter.prototype.scrollTop = function () {
return JQueryAdapter.prototype.GetWindowScrollPosition().y;
}
JQueryAdapter.prototype.scrollLeft = function () {
return JQueryAdapter.prototype.GetWindowScrollPosition().x;
}
Waypoint.adapters.push({
name: 'jquery',
Adapter: JQueryAdapter
})
Waypoint.Adapter = JQueryAdapter
}())
; (function () {
'use strict'
var Waypoint = window.Waypoint
function createExtension(framework) {
return function () {
var waypoints = []
var overrides = arguments[0]
if (framework.isFunction(arguments[0])) {
overrides = framework.extend({}, arguments[1])
overrides.handler = arguments[0]
}
this.each(function () {
var options = framework.extend({}, overrides, {
element: this
})
if (typeof options.context === 'string') {
options.context = framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}
}
if (window.jQuery) {
window.jQuery.fn.waypoint = createExtension(window.jQuery)
}
if (window.Zepto) {
window.Zepto.fn.waypoint = createExtension(window.Zepto)
}
// Added by WPSMITH
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs('iVisionjQSPWaypoints');
}())
;
namespace AGGSP.CONTROLTEMPLATES.AGGSP
{
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System.Web.UI;
public partial class Scripts : UserControl
{
// Override the CreateChildControls method to add our JS reference
protected override void CreateChildControls()
{
// Create a monitored scope for the developer dashboard, etc.
using (new SPMonitoredScope("AGGSP.CONTROLTEMPLATES.AGGSP.Scripts::CreateChildControls"))
{
// Get the server relative URL for the custom JavaScript
var scriptPath = SPContext.Current.Web.ServerRelativeUrl.TrimEnd('/') + "/_layouts/15/AGGSP/assets/js/";
// Testing/Debugging, write to console.
this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "iVisionLoaded", "console.log('Scripts.aspx.cs loaded');", true);
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionTestScriptLinkControlTemplate", scriptPath + "testScriptLinkControlTemplate.js");
// Ensure jQuery is loaded
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionjQuery", scriptPath + "jquery.min.js");
// Ensure Bootstrap is loaded
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionBootstrap", scriptPath + "bootstrap.min.js");
/*
* Register the JavaScript with the ClientScriptManager
* Scripts loaded in aspx file:
* Scriptblock: var head_conf={head:"ihead"};
* iVisionHeadJS, head.min.js
* iVisionjQuery, jquery.min.js (v.1.11.2)
* iVisionBootstrap, bootstrap.min.js
* iVisionMoment, moment.min.js
* iVisionGlobal, jquery.global.js
*
* Load global scripts:
* iVisionImagesLoaded
* iVisionIsotope
* iVisionjQSPWaypoints
* iVisionjQCountTo
* iVisionWaypointsDebug - Debug only
*/
this.Page.ClientScript.RegisterClientScriptInclude("iVisionImagesLoaded", scriptPath + "imagesloaded.pkgd.min.js");
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionIsotope", scriptPath + "isotope.pkgd.min.js");
// Add customized WayPoints for SharePoint
this.Page.ClientScript.RegisterClientScriptInclude("iVisionjQSPWaypoints", scriptPath + "jquery.sp.waypoints.js");
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionWaypointsDebug", scriptPath + "waypoints.debug.js");
//this.Page.ClientScript.RegisterClientScriptInclude("iVisionModernizer", scriptPath + "modernizer.min.js");
// Add iVision Scripts
this.Page.ClientScript.RegisterClientScriptInclude("iVisionCore", scriptPath + "ivision.core.js");
this.Page.ClientScript.RegisterClientScriptInclude("iVisionUtilities", scriptPath + "ivision.utilities.js");
this.Page.ClientScript.RegisterClientScriptInclude("iVisionScripts", scriptPath + "ivision.scripts.js");
this.Page.ClientScript.RegisterClientScriptInclude("iVisionjQ", scriptPath + "ivision.jquery.js");
// Create a SPReady event
this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "iVisionSPEvent", "_spBodyOnLoadFunctionNames.push(\"iVisionTriggerSPLoadedEvent\");function iVisionTriggerSPLoadedEvent() {jQuery.event.trigger({type: \"SPReady\",message: \"loaded\",time: new Date()});};\"undefined\"!=typeof jQuery && jQuery(document).on(\"SPReady\", function(jQuery) {console.log(\"SharePoint Loaded Event\");}) || {};", true);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment