Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ** code by tomal
- ** 2015
- */
- $('document').ready(function(){
- $('head').append('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">');
- $('.grid_5').html('<p style="color: black" align="right">Масштаб <span style="cursor: pointer" class="plus" onclick="plus()"><i class="fa fa-plus"></i></span> <span style="cursor: pointer" class="minus" onclick="minus()"><i class="fa fa-minus"></i></span> (+<span class="counter">0</span>0%)</p>');
- var zoom = getCookie('zoom');
- if(zoom != null){
- $('.counter').text(zoom);
- $('body').css('zoom', 1+(zoom/10));
- }
- });
- function plus(){
- if(parseInt($('.counter').text()) < 10){
- var count = parseInt($('.counter').text())+1;
- $('.counter').text(count);
- setzoom(count);
- }
- }
- function minus(){
- if(parseInt($('.counter').text()) != 0){
- var count = parseInt($('.counter').text())-1;
- $('.counter').text(count);
- setzoom(count);
- }
- }
- function setzoom(value){
- $('body').css('zoom', 1+(value/10));
- setCookie("zoom", value, 300, "/");
- }
- function setCookie(name, value, expiredays, path, domain, secure) {
- if (expiredays) {
- var exdate=new Date();
- exdate.setDate(exdate.getDate()+expiredays);
- var expires = exdate.toGMTString();
- }
- document.cookie = name + "=" + escape(value) +
- ((expiredays) ? "; expires=" + expires : "") +
- ((path) ? "; path=" + path : "") +
- ((domain) ? "; domain=" + domain : "") +
- ((secure) ? "; secure" : "");
- }
- function getCookie(name) {
- var cookie = " " + document.cookie;
- var search = " " + name + "=";
- var setStr = null;
- var offset = 0;
- var end = 0;
- if (cookie.length > 0) {
- offset = cookie.indexOf(search);
- if (offset != -1) {
- offset += search.length;
- end = cookie.indexOf(";", offset)
- if (end == -1) {
- end = cookie.length;
- }
- setStr = unescape(cookie.substring(offset, end));
- }
- }
- return setStr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement