Bones/node_modules/browser-sync-client/dist/index.min.js

1 line
19 KiB
JavaScript
Raw Normal View History

2017-05-17 13:45:25 -04:00
!function t(e,n,o){function r(s,c){if(!n[s]){if(!e[s]){var a="function"==typeof require&&require;if(!c&&a)return a(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};e[s][0].call(u.exports,function(t){var n=e[s][1][t];return r(n?n:t)},u,u.exports,t,e,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(t,e,n){"use strict";function o(t){return"undefined"==typeof t}function r(t,e){for(var n=0,o=e.split("."),r=o.length;r>n;n++){if(!t||"object"!=typeof t)return!1;t=t[o[n]]}return"undefined"==typeof t?!1:t}var i=t("./socket"),s=t("./emitter"),c=(t("./notify"),t("./tab"),t("./browser.utils")),a=function(t){this.options=t,this.socket=i,this.emitter=s,this.utils=c,this.tabHidden=!1;var e=this;i.on("options:set",function(t){s.emit("notify","Setting options..."),e.options=t.options}),s.on("tab:hidden",function(){e.tabHidden=!0}),s.on("tab:visible",function(){e.tabHidden=!1})};a.prototype.canSync=function(t,e){if(t=t||{},t.override)return!0;var n=!0;return e&&(n=this.getOption(e)),n&&t.url===window.location.pathname},a.prototype.getOption=function(t){if(t&&t.match(/\./))return r(this.options,t);var e=this.options[t];return o(e)?!1:e},e.exports=a},{"./browser.utils":2,"./emitter":5,"./notify":16,"./socket":17,"./tab":18}],2:[function(t,e,n){"use strict";var o=n;o.getWindow=function(){return window},o.getDocument=function(){return document},o.getBody=function(){return document.getElementsByTagName("body")[0]},o.getBrowserScrollPosition=function(){var t,e,o=n.getWindow(),r=n.getDocument(),i=r.documentElement,s=r.body;return void 0!==o.pageYOffset?(t=o.pageXOffset,e=o.pageYOffset):(t=i.scrollLeft||s.scrollLeft||0,e=i.scrollTop||s.scrollTop||0),{x:t,y:e}},o.getScrollSpace=function(){var t=n.getDocument(),e=t.documentElement,o=t.body;return{x:o.scrollHeight-e.clientWidth,y:o.scrollHeight-e.clientHeight}},o.saveScrollPosition=function(){var t=o.getBrowserScrollPosition();t=[t.x,t.y],o.getDocument.cookie="bs_scroll_pos="+t.join(",")},o.restoreScrollPosition=function(){var t=o.getDocument().cookie.replace(/(?:(?:^|.*;\s*)bs_scroll_pos\s*\=\s*([^;]*).*$)|^.*$/,"$1").split(",");o.getWindow().scrollTo(t[0],t[1])},o.getElementIndex=function(t,e){var n=o.getDocument().getElementsByTagName(t);return Array.prototype.indexOf.call(n,e)},o.forceChange=function(t){t.blur(),t.focus()},o.getElementData=function(t){var e=t.tagName,n=o.getElementIndex(e,t);return{tagName:e,index:n}},o.getSingleElement=function(t,e){var n=o.getDocument().getElementsByTagName(t);return n[e]},o.getBody=function(){return o.getDocument().getElementsByTagName("body")[0]},o.setScroll=function(t){o.getWindow().scrollTo(t.x,t.y)},o.reloadBrowser=function(){o.getWindow().location.reload(!0)},o.forEach=function(t,e){for(var n=0,o=t.length;o>n;n+=1)e(t[n],n,t)},o.isOldIe=function(){return"undefined"!=typeof o.getWindow().attachEvent},o.getLocation=function(t){var e=o.getDocument().createElement("a");return e.href=t,""===e.host&&(e.href=e.href),e}},{}],3:[function(t,e,n){"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),0>e&&(e+=this.length),0>e&&(e=0);for(var n=this.length;n>e;e+=1)if(e in this&&this[e]===t)return e;return-1}),Array.prototype.map||(Array.prototype.map=function(t,e){var n,o,r;if(null==this)throw new TypeError(" this is null or not defined");var i=Object(this),s=i.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(n=e),o=new Array(s),r=0;s>r;){var c,a;r in i&&(c=i[r],a=t.call(n,c,r,i),o[r]=a),r++}return o}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var o=[],r=arguments.length>=2?arguments[1]:void 0,i=0;n>i;i++)if(i in e){var s=e[i];t.call(r,s,i,e)&&o.push(s)}return o})},{}],4:[function(t,e,n){"use strict";var o,r=t("./events"),i=t("./browser.utils"),s=t("./emitter"),c=n,a={tag