Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * these are not dependant on jQuery
- * but they do so on:
- *
- * /js/detectmobilebrowser.js
- * /js/modernizr.js
- * /js/yepnope.js
- * /js/functions.js
- * /js/events.js
- * /js/ready.js
- */
- /**
- * declare sbizDocumentReferrer
- */
- var sbizDocumentReferrer = document.referrer || "";
- /**
- * declare sbizWindowLocation
- */
- var sbizWindowLocation = window.location.href || "";
- /**
- * declare sbizDocumentTitle
- */
- var sbizDocumentTitle = document.title || "";
- /**
- * declare sbizDeviceWidth
- * http://stackoverflow.com/questions/6850164/get-the-device-width-in-javascript
- */
- var sbizDeviceWidth = window.innerWidth ? 0 < window.innerWidth ? window.innerWidth : screen.width : "";
- /**
- * declare sbizIsHandheld
- */
- var sbizIsHandheld = ("undefined" !== typeof sbizIsMobileBrowser && sbizIsMobileBrowser && (sbizIsHandheld = 1)) || "";
- /**
- * declare sbizIsOutdatedBrowser
- */
- var sbizIsOutdatedBrowser = "";
- /**
- * Modernizr test for cssgradients
- */
- var sbizHasCssgradients = ("undefined" !== typeof window.Modernizr && Modernizr.cssgradients && (sbizHasCssgradients = 1)) || "";
- /**
- * treat no сssgradients
- * and not mobile as outdated browser
- * !sbizHasCssgradients && !sbizIsHandheld && (sbizIsOutdatedBrowser = 1);
- */
- /**
- * Modernizr test for touch
- */
- var sbizHasTouch = ("undefined" !== typeof window.Modernizr && Modernizr.touch && (sbizHasTouch = 1)) || "";
- /**
- * treat sbizHasTouch and sbizDeviceWidth < 980
- * as mobile browser
- */
- sbizHasTouch && 980 > sbizDeviceWidth && (sbizIsHandheld = 1);
- /**
- * treat outdated browser as handheld
- * after Modernizr tests
- */
- sbizIsOutdatedBrowser && (sbizIsHandheld = 1);
- /**
- * get externalcounter when browser tab is inactive
- * dependant on variables above
- *
- * window.onblur = function () {
- *
- * };
- */
- addEvent(window, "blur", function (e) {
- /* reassign document.title !!! */
- document.title = sbizDocumentTitle +
- " - \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 " +
- "\u043d\u0435 " +
- "\u0430\u043a\u0442\u0438\u0432\u0435\u043d";
- var a = document.getElementById("externalcounters"),
- b = (/localhost/.test(self.location.host) ? "http://localhost/externalcounters/" : "http://shimansky.biz/externalcounters/"),
- z = sbizIsHandheld,
- y = sbizIsOutdatedBrowser,
- k = sbizDeviceWidth,
- m = sbizHasCssgradients,
- t = sbizHasTouch,
- rfrr = encodeURIComponent(sbizDocumentReferrer),
- dmn = encodeURIComponent(sbizWindowLocation),
- /* don't use sbizDocumentTitle !!! -- we need to get new document.title */
- ttl0 = encodeURIComponent(document.title || "").replace("\x27", "'"),
- ttl = ttl0 +
- " [sbizDeviceWidth:" + k +
- "; sbizIsHandheld:" + z +
- "; sbizHasCssgradients:" + m +
- "; sbizHasTouch:" + t +
- "; sbizIsOutdatedBrowser:" + y +
- "]";
- a && (a.setAttribute("style", "position:absolute;left:-9999px;width:1px;height:1px;border:0;background:transparent url(\x27" + b +
- "?dmn=" + dmn +
- "\x26rfrr=" + rfrr +
- "\x26ttl=" + ttl +
- "\x26encoding=utf-8\x27) top left no-repeat;"));
- }, false);
- /**
- * get JS errors using Google Analytics
- * http://habrahabr.ru/post/149926/
- *
- * window.onerror = function (msg, url, line) {
- *
- * };
- */
- var _gaq = window._gaq || [];
- addEvent(window, "error", function (msg, url, line) {
- var preventErrorAlert = true;
- _gaq.push(["_trackEvent", "JS Error", msg, navigator.userAgent + ' -> ' + url + " : " + line]);
- return preventErrorAlert;
- }, false);
- /**
- * hide navbar if mobile
- */
- (function (a) {
- "use strict";
- if (a) {
- addEvent(window, "load", function (e) {
- setTimeout(function () {
- window.scrollTo(0, 1);
- }, 1);
- }, false);
- }
- }
- (sbizIsHandheld || ""));
- /**
- * open outer links in new tab
- */
- domready(function(){
- "use strict";
- (function (c, a, f) {
- if (c && a && f) {
- var b,
- e,
- d,
- h,
- g,
- r = "";
- for (b = 0; b < c.length; b += 1) {
- d = c[b];
- h = d.getAttribute("href");
- if (
- (h.match(/^http\:\/\//)
- || h.match(/^https\:\/\//)
- || h.match(/^ftp\:\/\//))
- && !d.getAttribute("rel")
- && !d.getAttribute("id")
- && !d.getAttribute("class")
- ) {
- for (e = [a, f], g = 0; g < e.length; g += 1) {
- if (h.match(new RegExp(e[g]))) {
- r = 1;
- }
- if (!r) {
- d.setAttribute("target", "_blank");
- d.setAttribute("rel", "tipsy");
- d.setAttribute("title", "\u042d\u0442\u0430 " + "\u0441\u0441\u044b\u043b\u043a\u0430 " + "\u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 " + "\u0440\u0435\u0441\u0443\u0440\u0441 " + "\u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f " + "\u0432 " + "\u043d\u043e\u0432\u043e\u0439 " + "\u0432\u043a\u043b\u0430\u0434\u043a\u0435 " + "\u0438\u043b\u0438 \u043e\u043a\u043d\u0435.");
- }
- }
- }
- }
- }
- }
- (
- (document.getElementsByTagName("a") || ""),
- ((self.location.protocol + "//" + self.location.host + "/") || ""),
- ((self.location.host + "/") || "")
- ));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement