/**
* HabraAlert 0.2
* author DeerUA
* version 0.2.0 01.12.2009
* license as-is PL
* include after
or before, as u wish
message("all good"); (5 .)
error("attention"); (7 .)
warning("something wrong"); (10 .)
*/
initHA = function() {
var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");
var styles = "div#messages{position:fixed;top:50px;right:0px;width:250px;margin:0px;padding:7px;background:transparent;z-index:2}"+
"div#messages div{cursor: pointer;color:#fff;padding:7px;margin-bottom:7px;-moz-border-radius:5px;-webkit-border-radius:5px;-khtml-border-radius:5px;opacity:0.65;background:#888;font: normal 12px 'Georgia'}"+
"div#messages div.error{background:#98001b} div#messages div.message{background:#0d8529}div#messages div.warning{background:#dd6; color:#333}";
var iestyles = "body{position:relative}div#messages{position:absolute; -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=65)'; filter: alpha(opacity=65)}div#messages div{cursor: hand}";
addLoadEvent = function(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') { window.onload = func;}
else {window.onload = function() { if (oldonload) {oldonload();}func();}}
}
import_style = function(src){
if ((src == null || src == undefined)) return;
var imprt = document.createElement('style');
imprt.setAttribute("type", "text/css");
if (imprt.styleSheet) imprt.styleSheet.cssText = src;
else imprt.appendChild(document.createTextNode(src));
document.getElementsByTagName('head')[0].appendChild(imprt);
}
addAll = function() {
var messageBox = document.createElement ('div');
messageBox.id = "messages";
if (document.body.firstChild) document.body.insertBefore(messageBox, document.body.firstChild);
else document.body.appendChild(messageBox);
import_style(styles);
if (is_ie6) import_style(iestyles);
}
if (document.body == null) return addLoadEvent(function() {addAll();});
addAll();
}
initHA();
message = function (mtext, mtype, howlong) {
var mtype = mtype || 'message';
var howlong = howlong || 5000;
if (document.getElementById('messages') == null) {
setTimeout(function(){message (mtext, mtype, howlong)}, 100);
return;
}
var alarm = document.createElement ('div');
alarm.className = mtype;
alarm.innerHTML = mtext;
alarm.onclick = function () {
alarm.style.display = "none";
};
alarm.del = function () {
document.getElementById('messages').removeChild (alarm);
};
document.getElementById('messages').appendChild (alarm);
setTimeout (alarm.del, howlong);
}
error = function (mtext, howlong) {
var howlong = howlong || 10000;
message(mtext,"error",howlong);
}
warning = function (mtext, howlong) {
var howlong = howlong || 7000;
message(mtext,"warning",howlong);
}/*jslint browser: true */ /*global jQuery: true */
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and value given, set cookie...
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
options = jQuery.extend({}, options);
if (value === null) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? String(value) : encodeURIComponent(String(value)),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
function getOffset(elem) {
if (elem.getBoundingClientRect) {
// "правильный" вариант
return getOffsetRect(elem)
} else {
// пусть работает хоть как-то
return getOffsetSum(elem)
}
}
function getOffsetSum(elem) {
var top=0, left=0
while(elem) {
top = top + parseInt(elem.offsetTop)
left = left + parseInt(elem.offsetLeft)
elem = elem.offsetParent
}
return {top: top, left: left}
}
function getOffsetRect(elem) {
// (1)
var box = elem.getBoundingClientRect()
// (2)
var body = document.body
var docElem = document.documentElement
// (3)
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft
// (4)
var clientTop = docElem.clientTop || body.clientTop || 0
var clientLeft = docElem.clientLeft || body.clientLeft || 0
// (5)
var top = box.top + scrollTop - clientTop
var left = box.left + scrollLeft - clientLeft
return { top: Math.round(top), left: Math.round(left) }
}
function scrollto(id){
var pos = getOffset(document.getElementById(id));
window.scrollTo(0, pos.top);
}/*
* jQuery Superfish Menu Plugin
* Copyright (c) 2013 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function ($) {
"use strict";
var methods = (function () {
// private properties and methods go here
var c = {
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
anchorClass: 'sf-with-ul',
menuArrowClass: 'sf-arrows'
},
ios = (function () {
var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent);
if (ios) {
// iOS clicks only bubble as far as body children
$(window).load(function () {
$('body').children().on('click', $.noop);
});
}
return ios;
})(),
wp7 = (function () {
var style = document.documentElement.style;
return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
})(),
toggleMenuClasses = function ($menu, o) {
var classes = c.menuClass;
if (o.cssArrows) {
classes += ' ' + c.menuArrowClass;
}
$menu.toggleClass(classes);
},
setPathToCurrent = function ($menu, o) {
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
.addClass(o.hoverClass + ' ' + c.bcClass)
.filter(function () {
return ($(this).children(o.popUpSelector).hide().show().length);
}).removeClass(o.pathClass);
},
toggleAnchorClass = function ($li) {
$li.children('a').toggleClass(c.anchorClass);
},
toggleTouchAction = function ($menu) {
var touchAction = $menu.css('ms-touch-action');
touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
$menu.css('ms-touch-action', touchAction);
},
applyHandlers = function ($menu, o) {
var targets = 'li:has(' + o.popUpSelector + ')';
if ($.fn.hoverIntent && !o.disableHI) {
$menu.hoverIntent(over, out, targets);
}
else {
$menu
.on('mouseenter.superfish', targets, over)
.on('mouseleave.superfish', targets, out);
}
var touchevent = 'MSPointerDown.superfish';
if (!ios) {
touchevent += ' touchend.superfish';
}
if (wp7) {
touchevent += ' mousedown.superfish';
}
$menu
.on('focusin.superfish', 'li', over)
.on('focusout.superfish', 'li', out)
.on(touchevent, 'a', o, touchHandler);
},
touchHandler = function (e) {
var $this = $(this),
$ul = $this.siblings(e.data.popUpSelector);
if ($ul.length > 0 && $ul.is(':hidden')) {
$this.one('click.superfish', false);
if (e.type === 'MSPointerDown') {
$this.trigger('focus');
} else {
$.proxy(over, $this.parent('li'))();
}
}
},
over = function () {
var $this = $(this),
o = getOptions($this);
clearTimeout(o.sfTimer);
$this.siblings().superfish('hide').end().superfish('show');
},
out = function () {
var $this = $(this),
o = getOptions($this);
if (ios) {
$.proxy(close, $this, o)();
}
else {
clearTimeout(o.sfTimer);
o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
}
},
close = function (o) {
o.retainPath = ($.inArray(this[0], o.$path) > -1);
this.superfish('hide');
if (!this.parents('.' + o.hoverClass).length) {
o.onIdle.call(getMenu(this));
if (o.$path.length) {
$.proxy(over, o.$path)();
}
}
},
getMenu = function ($el) {
return $el.closest('.' + c.menuClass);
},
getOptions = function ($el) {
return getMenu($el).data('sf-options');
};
return {
// public methods
hide: function (instant) {
if (this.length) {
var $this = this,
o = getOptions($this);
if (!o) {
return this;
}
var not = (o.retainPath === true) ? o.$path : '',
$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
speed = o.speedOut;
if (instant) {
$ul.show();
speed = 0;
}
o.retainPath = false;
o.onBeforeHide.call($ul);
$ul.stop(true, true).animate(o.animationOut, speed, function () {
var $this = $(this);
o.onHide.call($this);
});
}
return this;
},
show: function () {
var o = getOptions(this);
if (!o) {
return this;
}
var $this = this.addClass(o.hoverClass),
$ul = $this.children(o.popUpSelector);
o.onBeforeShow.call($ul);
$ul.stop(true, true).animate(o.animation, o.speed, function () {
o.onShow.call($ul);
});
return this;
},
destroy: function () {
return this.each(function () {
var $this = $(this),
o = $this.data('sf-options'),
$hasPopUp;
if (!o) {
return false;
}
$hasPopUp = $this.find(o.popUpSelector).parent('li');
clearTimeout(o.sfTimer);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
// remove event handlers
$this.off('.superfish').off('.hoverIntent');
// clear animation's inline display style
$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
return style.replace(/display[^;]+;?/g, '');
});
// reset 'current' path classes
o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
o.onDestroy.call($this);
$this.removeData('sf-options');
});
},
init: function (op) {
return this.each(function () {
var $this = $(this);
if ($this.data('sf-options')) {
return false;
}
var o = $.extend({}, $.fn.superfish.defaults, op),
$hasPopUp = $this.find(o.popUpSelector).parent('li');
o.$path = setPathToCurrent($this, o);
$this.data('sf-options', o);
toggleMenuClasses($this, o);
toggleAnchorClass($hasPopUp);
toggleTouchAction($this);
applyHandlers($this, o);
$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
o.onInit.call(this);
});
}
};
})();
$.fn.superfish = function (method, args) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
}
else {
return $.error('Method ' + method + ' does not exist on jQuery.fn.superfish');
}
};
$.fn.superfish.defaults = {
popUpSelector: 'ul,.sf-mega', // within menu context
hoverClass: 'sfHover',
pathClass: 'overrideThisToUse',
pathLevels: 1,
delay: 800,
animation: {opacity: 'show'},
animationOut: {opacity: 'hide'},
speed: 'normal',
speedOut: 'fast',
cssArrows: true,
disableHI: false,
onInit: $.noop,
onBeforeShow: $.noop,
onShow: $.noop,
onBeforeHide: $.noop,
onHide: $.noop,
onIdle: $.noop,
onDestroy: $.noop
};
// soon to be deprecated
$.fn.extend({
hideSuperfishUl: methods.hide,
showSuperfishUl: methods.show
});
})(jQuery);
/*
* Copyright (C) 2012 PrimeBox (info@primebox.co.uk)
*
* This work is licensed under the Creative Commons
* Attribution 3.0 Unported License. To view a copy
* of this license, visit
* http://creativecommons.org/licenses/by/3.0/.
*
* Documentation available at:
* http://www.primebox.co.uk/projects/cookie-bar/
*
* When using this software you use it at your own risk. We hold
* no responsibility for any damage caused by using this plugin
* or the documentation provided.
*/
(function($){
$.cookieBar = function(options,val){
if(options=='cookies'){
var doReturn = 'cookies';
}else if(options=='set'){
var doReturn = 'set';
}else{
var doReturn = false;
}
var defaults = {
message: 'We use cookies to track usage and preferences.', //Message displayed on bar
acceptButton: true, //Set to true to show accept/enable button
acceptText: 'I Understand', //Text on accept/enable button
acceptFunction: function(cookieValue){if(cookieValue!='enabled' && cookieValue!='accepted') window.location = window.location.href;}, //Function to run after accept
declineButton: false, //Set to true to show decline/disable button
declineText: 'Disable Cookies', //Text on decline/disable button
declineFunction: function(cookieValue){if(cookieValue=='enabled' || cookieValue=='accepted') window.location = window.location.href;}, //Function to run after decline
policyButton: false, //Set to true to show Privacy Policy button
policyText: 'Privacy Policy', //Text on Privacy Policy button
policyURL: '/privacy-policy/', //URL of Privacy Policy
autoEnable: true, //Set to true for cookies to be accepted automatically. Banner still shows
acceptOnContinue: false, //Set to true to accept cookies when visitor moves to another page
acceptOnScroll: false, //Set to true to accept cookies when visitor scrolls X pixels up or down
acceptAnyClick: false, //Set to true to accept cookies when visitor clicks anywhere on the page
expireDays: 365, //Number of days for cookieBar cookie to be stored for
renewOnVisit: false, //Renew the cookie upon revisit to website
forceShow: false, //Force cookieBar to show regardless of user cookie preference
effect: 'slide', //Options: slide, fade, hide
element: 'body', //Element to append/prepend cookieBar to. Remember "." for class or "#" for id.
append: false, //Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS
fixed: false, //Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position
bottom: false, //Force CSS when fixed, so bar appears at bottom of website
zindex: '', //Can be set in CSS, although some may prefer to set here
domain: String(window.location.hostname), //Location of privacy policy
referrer: String(document.referrer) //Where visitor has come from
};
var options = $.extend(defaults,options);
//Sets expiration date for cookie
var expireDate = new Date();
expireDate.setTime(expireDate.getTime()+(options.expireDays*86400000));
expireDate = expireDate.toGMTString();
var cookieEntry = 'cb-enabled={value}; expires='+expireDate+'; path=/';
//Retrieves current cookie preference
var i,cookieValue='',aCookie,aCookies=document.cookie.split('; ');
for (i=0;i=0 && String(window.location.href).indexOf(options.policyURL)==-1 && doReturn!='cookies' && doReturn!='set' && cookieValue!='accepted' && cookieValue!='declined'){
doReturn = 'set';
val = 'accepted';
}
}
if(doReturn=='cookies'){
//Returns true if cookies are enabled, false otherwise
if(cookieValue=='enabled' || cookieValue=='accepted'){
return true;
}else{
return false;
}
}else if(doReturn=='set' && (val=='accepted' || val=='declined')){
//Sets value of cookie to 'accepted' or 'declined'
document.cookie = cookieEntry.replace('{value}',val);
if(val=='accepted'){
return true;
}else{
return false;
}
}else{
//Sets up enable/accept button if required
var message = options.message.replace('{policy_url}',options.policyURL);
if(options.acceptButton){
var acceptButton = ''+options.acceptText+'';
}else{
var acceptButton = '';
}
//Sets up disable/decline button if required
if(options.declineButton){
var declineButton = ''+options.declineText+'';
}else{
var declineButton = '';
}
//Sets up privacy policy button if required
if(options.policyButton){
var policyButton = ''+options.policyText+'';
}else{
var policyButton = '';
}
//Whether to add "fixed" class to cookie bar
if(options.fixed){
if(options.bottom){
var fixed = ' class="fixed bottom"';
}else{
var fixed = ' class="fixed"';
}
}else{
var fixed = '';
}
if(options.zindex!=''){
var zindex = ' style="z-index:'+options.zindex+';"';
}else{
var zindex = '';
}
//Displays the cookie bar if arguments met
if(options.forceShow || cookieValue=='enabled' || cookieValue==''){
if(options.append){
$(options.element).append('