PageSourceSearch

http://www.brojed.org/cms//templates/shape5_vertex/js/s5_font_adjuster.js

js brojed.org collected 2026-10-02 13:47:04 UTC 3,811 bytes, 106 lines download raw bytes

1/*
2FontSizer v2.2
3Javascript to dynamically change font sizes on a web page.
4Coded by Phil Nash of www.unintentionallyblank.co.uk
5Cookies script courtesy of http://www.quirksmode.org/js/cookies.html
6Measuring the current font size courtesy of http://www.alistapart.com/articles/fontresizing
7
8** Please don't remove this notice **
9
10See http://www.unintentionallyblank.co.uk/2007/11/09/fontsizer-reloaded-changing-font-sizes-with-javascript/ for full details
11  
12*/
13
14addDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/if(/WebKit/i.test(navigator.userAgent))t=setInterval(function(){/loaded|complete/.test(d[r])&&x()},10);o=w.onload;w.onload=function(){x();o&&o()}}e.push(f)}})();
15
16
17var s5_font_adjuster_cookie_name = window.location;
18
19s5_font_adjuster_cookie_name = s5_font_adjuster_cookie_name.toString(); 
20
21if (s5_font_adjuster_cookie_name.indexOf("index") > 0) {
22
23	var s5_font_adjuster_cookie_name_array = s5_font_adjuster_cookie_name.split("index");
24	s5_font_adjuster_cookie_name = s5_font_adjuster_cookie_name_array[0];
25
26}
27
28var fS={
29  iFS:null,
30  cFS:null,
31  init: function (fC) {
32    if (!document.getElementById || !document.createTextNode) { return; }
33    if (UBCookie.read(s5_font_adjuster_cookie_name)) {
34      var sizes = UBCookie.read(s5_font_adjuster_cookie_name).split(",");
35      fS.iFS = sizes[0]*1; 
36      fS.cFS = sizes[1]*1;
37      fS.setBodySize();
38    } else {
39      var el = document.createElement('span');
40      el.innerHTML = "&nbsp;";
41      el.style.position = "absolute";
42      el.style.left = "-9999px";
43      el.style.lineHeight = "1em";
44      document.body.insertBefore(el,document.body.firstChild);
45      fS.iFS = el.offsetHeight/16;
46      fS.cFS = fS.iFS;
47      UBCookie.create(s5_font_adjuster_cookie_name,fS.iFS+","+fS.cFS,30);
48    }
49	fS.addJSLink(fC,fS.decFS,"A","decreaseSize");
50	fS.addJSLink(fC,fS.rFS,"A","resetSize");
51    fS.addJSLink(fC,fS.incFS,"A","increaseSize");
52  },
53  incFS: function () {
54    fS.cFS = fS.cFS*1.1;
55    fS.setBodySize();
56    return false;
57  },
58  decFS: function () {
59    fS.cFS = fS.cFS*0.9;
60    fS.setBodySize();
61    return false;
62  },
63  rFS: function () {
64    fS.cFS = fS.iFS;
65    fS.setBodySize();
66    return false;
67  },
68  setBodySize: function() {
69		document.body.style.fontSize = fS.cFS + 'em';
70    UBCookie.create(s5_font_adjuster_cookie_name,fS.iFS+","+fS.cFS,30);
71  },
72  addJSLink: function (elementId, onClickFunction, linkText, className) {
73	var element = document.getElementById(elementId);
74	var link = document.createElement("a");
75	link.className = className;
76	var linkText = document.createTextNode(linkText);
77	link.appendChild(linkText);
78	link.onclick = onClickFunction;
79	link.href="javascript:;"+elementId;
80	element.appendChild(link);
81  }
82}
83
84var UBCookie={
85  create: function (name,value,days) {
86	if (days) {
87	  var date = new Date();
88	  date.setTime(date.getTime()+(days*24*60*60*1000));
89	  var expires = "; expires="+date.toGMTString();
90	} else { var expires = ""; }
91	document.cookie = name+"="+value+expires+"; path=/";
92  },
93  read: function (name) {
94	var nameEQ = name + "=";
95	var ca = document.cookie.split(';');
96	for(var i=0;i < ca.length;i++) {
97	  var c = ca[i];
98	  while (c.charAt(0)==' ') c = c.substring(1,c.length);
99	  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
100	}
101	return null;
102  },
103  erase: function(name) { createCookie(name,"",-1); }
104}
105
106addDOMLoadEvent(function() {fS.init("fontControls")});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.