[AMAZING!] Secret codes


SUBMITTED BY: Guest

DATE: June 5, 2013, 4:27 p.m.

FORMAT: Text only

SIZE: 22.7 kB

HITS: 927

  1. String.prototype.ltrim = function() {
  2. return this.replace(/^\s+/,"");
  3. }
  4. ch_ad_url = '';
  5. ch_chitika_loaded = true;
  6. ch_amm_version = "1.15.1";
  7. function dq(s) { return (s != null) ? '"' + s + '"' : '""'; }
  8. function ch_au(p,v) { if (v) { window.ch_ad_url += '&' + p + '=' + v; } }
  9. function ch_aue(p,v) { if (v) { ch_au(p,encodeURIComponent(v)); } }
  10. function ch_aun(p, v) { if (v) { ch_au(p, v.replace(/[\W]+/, '_').toLowerCase()); } }
  11. function ch_def(v, def) { return (v) ? v : def; }
  12. function ch_ad_render_search(response) {
  13. var w = window;
  14. if (response === undefined) {
  15. response = w.ch_mmhtml;
  16. }
  17. if (response !== undefined) {
  18. var thehtml = w.ch_mmhtml["output"];
  19. if (thehtml) {
  20. ch_decision(response, true);
  21. return;
  22. }
  23. }
  24. ch_decision(response, false);
  25. }
  26. function ch_get_real_height(body) {
  27. if (navigator.userAgent.match(/MSIE [6-8]\.0/)) {
  28. return body.scrollHeight;
  29. }
  30. return body.offsetHeight;
  31. }
  32. function ch_ad_locate(obj) {
  33. var objPos = {'x':0,'y':0};
  34. try {
  35. if(obj.offsetParent) {
  36. while(1) {
  37. objPos.x += obj.offsetLeft;
  38. objPos.y += obj.offsetTop;
  39. if(!obj.offsetParent) { break; }
  40. obj = obj.offsetParent;
  41. }
  42. } else if(obj.x && obj.y) {
  43. objPos.x += obj.x;
  44. objPos.y += obj.y;
  45. }
  46. } catch (err) {
  47. objPos.x = -1;
  48. objPos.y = -1;
  49. }
  50. return objPos;
  51. }
  52. function ch_add_script(url) {
  53. if (typeof(url) !== 'string') {return undefined;}
  54. var h = document.getElementsByTagName('head')[0];
  55. if (!h) {return undefined;}
  56. var s = document.createElement('script');
  57. s.type = 'text/javascript';
  58. s.src = url;
  59. h.appendChild(s);
  60. return s;
  61. }
  62. function get_text(node) {
  63. var r = '';
  64. if (node.innerText !== undefined) {
  65. r = node.innerText;
  66. } else if (node.textContent !== undefined) {
  67. r = node.textContent;
  68. }
  69. return r;
  70. }
  71. function ch_get_snippet(){
  72. try{
  73. var snippetPriority = new Array('title', 'h1', 'keywords', 'description');
  74. var snippetCount = 1;
  75. var snippetMaxLength = 100;
  76. var snippetData = new Array();
  77. if (document.getElementsByTagName){
  78. var metaTags = document.getElementsByTagName('meta');
  79. for(var meta=0; meta<metaTags.length; meta++){
  80. var name = metaTags[meta].getAttribute('name'),
  81. content = metaTags[meta].getAttribute('content');
  82. if (name && content) {
  83. snippetData[name.toLowerCase()] = content;
  84. }
  85. }
  86. if (document.title){ snippetData['title'] = document.title; }
  87. var tags = document.getElementsByTagName('h1');
  88. if (tags.length > 0) {
  89. snippetData['h1'] = get_text(tags[0]);
  90. }
  91. }
  92. var snipCount = 0;
  93. for ( var snip in snippetPriority ) {
  94. if (snipCount >= snippetCount) { break; }
  95. var snippet = snippetPriority[snip];
  96. if (snippetData[snippet]) {
  97. snipCount++;
  98. ch_aue('snip_' + snippet, snippetData[snippet].substring(0, snippetMaxLength));
  99. }
  100. }
  101. }catch(err){}
  102. }
  103. function ch_get_style(x, styleProp) {
  104. if (x.currentStyle) {
  105. return x.currentStyle[styleProp];
  106. } else if (window.getComputedStyle) {
  107. return document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
  108. }
  109. }
  110. function append_func(o, a) {
  111. return function (e) {
  112. if (typeof(o) == "function") { o(e); }
  113. return a(e);
  114. };
  115. }
  116. function ch_write_iframe(f, thehtml, r, width, height) {
  117. var w = window;
  118. var d = w.ch_dim["ch_ad"+r];
  119. if (typeof(f) == "undefined"){
  120. return; //f was undefined crashing Chrome for Mac.
  121. }
  122. var fobj = document.createElement("iframe");
  123. var _id = "ch_ad_ctr"+r;
  124. fobj.src = "about:blank";
  125. try {fobj.contentWindow.document.designMode = "on";} catch (e) {}
  126. fobj.border = "0";
  127. fobj.style.margin = fobj.style.padding = fobj.style.border= 0;
  128. fobj.padding = "0";
  129. fobj.frameBorder = 0;
  130. fobj.marginWidth = 0;
  131. fobj.marginHeight = 0;
  132. fobj.vspace = 0;
  133. fobj.hspace = 0;
  134. fobj.scrolling = "no";
  135. fobj.setAttribute("class", "chitikaAdBlock");
  136. fobj.setAttribute("allowTransparency", "allowTransparency");
  137. fobj.setAttribute("name", _id);
  138. fobj.setAttribute("id", _id);
  139. // If we specified fluid width
  140. var fctr = document.createElement("div"); // Create a container div
  141. fctr.style.position = 'static';
  142. fctr.appendChild(fobj);
  143. if(d[6]){
  144. try{
  145. try{fctr.style.zoom = 1;}catch(e){} // Makes IE6 behave. Zoom is not a standard property, so suppress any possible errors in other browsers
  146. fctr.style.width = "auto"; // Width auto and overflow hidden trigger a special box rendering mode, which causes
  147. fctr.style.overflow = "hidden"; // the element to not flow under floated elements
  148. fobj.style.width = "100%"; // Thus allowing us to specify 100% width on the iframe without breaking the page
  149. fctr.style.position = 'relative';
  150. }catch(e){}
  151. }
  152. // If we specified fluid height
  153. if(d[7]){
  154. try{
  155. // The function we use to resize
  156. var ch_resize_height = function() {
  157. try{
  158. _height = ch_get_real_height(fobj.contentWindow.document.body);
  159. if(!fobj.bResizeSet) {
  160. if(w.addEventListener){
  161. fobj.contentWindow.onresize = append_func(fobj.contentWindow.onresize, fobj.onload);
  162. }else{
  163. fobj.contentWindow.attachEvent("onresize", fobj.onload);
  164. }
  165. fobj.bResizeSet = true;
  166. }
  167. fobj.style.height = "" + _height + "px";
  168. }catch(e){ }
  169. return true;
  170. }
  171. if(window.addEventListener){ // This is the standardized method, but...
  172. fobj.onload = append_func(fobj.onload, ch_resize_height); // We can assign functions directly
  173. w.onresize = append_func(w.onresize, ch_resize_height);
  174. }else{ // IE doesn't use the standardized function
  175. fobj.attachEvent("onload", append_func(fobj.onload, ch_resize_height)); // And we have to use attachEvent, because it doesn't like
  176. w.attachEvent("onresize", append_func(w.onreszize, ch_resize_height)); // direct assignment of onload.
  177. fobj.ch_resize = ch_resize_height;
  178. }
  179. }catch(e){}
  180. }
  181. var tries = 0;
  182. var interval;
  183. var checkDisplay = function() {
  184. if (typeof(f) == "undefined" || f == null){
  185. w.clearInterval(interval);
  186. return;
  187. }
  188. if (tries++ > 70) {
  189. w.clearInterval(interval);
  190. }
  191. var p = fobj;
  192. noDisplayNone = true;
  193. while (p != null) {
  194. try {
  195. st = ch_get_style(p, "display");
  196. if (st == "none") {
  197. noDisplayNone = false;
  198. break;
  199. }
  200. } catch(e) {}
  201. p = p.parentNode;
  202. }
  203. try{ p = f.parentNode; } catch(e){return;}
  204. if (noDisplayNone) {
  205. w.clearInterval(interval);
  206. if (width && height) {
  207. fobj.width = width;
  208. fobj.height = height;
  209. } else {
  210. fobj.width = d[0];fobj.height = d[1];
  211. }
  212. if(typeof(fctr) != "undefined"){
  213. f.parentNode.insertBefore(fctr,f);
  214. }else{
  215. f.parentNode.insertBefore(fobj,f);
  216. }
  217. try{
  218. var fdoc = fobj.contentWindow.document;
  219. fdoc.open();
  220. fdoc.write(thehtml);
  221. // setTimeout for a bug fix; for some reason the document's onload event doesn't fire if the containing element has position set, unless I add a delay...
  222. setTimeout(function() { fdoc.close(); }, 16);
  223. if(typeof(fobj.ch_resize) != "undefined") {
  224. fobj.ch_resize();
  225. }
  226. }catch(e){}
  227. }
  228. }
  229. interval = w.setInterval(checkDisplay, 100);
  230. }
  231. function ch_decision(response, render) {
  232. var w = window;
  233. var r = response["cb"];
  234. var thehtml = response["output"];
  235. var f = document.getElementById("ch_ad"+r);
  236. if (!f) {return;}
  237. if (response["js"]) {
  238. for (var i = 0; i < response.js.length; i++) {
  239. var url = response.js[i];
  240. ch_add_script(url);
  241. }
  242. }
  243. if (response["hover"]) {
  244. w.ch_hover_content = response["hover"]["html"];
  245. w.ch_mobile_height = response["hover"]["height"];
  246. w.ch_mobile_width = response["hover"]["width"];
  247. w.ch_mobile_padding = response["hover"]["padding"];
  248. if (response["hover"]["type"] === 'hover-iphone2' ||
  249. response["hover"]["type"] === 'hover-iphone-call') {
  250. ch_add_script('http://maps-static.chitika.net/js/m.js');
  251. } else if (response["hover"]["type"] === 'hover-ipad') {
  252. ch_add_script('http://maps-static.chitika.net/js/m.js');
  253. } else if (response["hover"]["type"] === 'hover-pc') {
  254. ch_add_script('http://scripts.chitika.net/mobile/js/pc.js');
  255. } else {
  256. ch_add_script('http://maps-static.chitika.net/js/m.js');
  257. var mobileCSS = document.createElement('link');
  258. mobileCSS.type = 'text/css';
  259. mobileCSS.rel = 'stylesheet';
  260. mobileCSS.href = 'http://maps-static.chitika.net/misc/m.css';
  261. ch_pg_head.appendChild(mobileCSS);
  262. }
  263. }
  264. if (response["pixels"]) {
  265. for (var k = 0; k < response.pixels.length; k++) {
  266. var url = response.pixels[k];
  267. var fimg = document.createElement("img");
  268. fimg.border = 0;
  269. fimg.style.border = 'none';
  270. fimg.style.display = 'none';
  271. fimg.width = 1;
  272. fimg.height = 1;
  273. fimg.src = url;
  274. document.body.appendChild(fimg);
  275. }
  276. }
  277. if (thehtml && render) {
  278. ch_write_iframe(f, thehtml, r, null, null);
  279. } else {
  280. f.style.display = "none";
  281. ch_chitika_loaded = false;
  282. if (response["alturl"]) {
  283. var d = w.ch_dim["ch_ad"+r];
  284. var fobj = document.createElement("iframe");
  285. fobj.src = response["alturl"];
  286. fobj.border = "0";
  287. fobj.style.margin = fobj.style.padding = fobj.style.border= 0;
  288. fobj.padding = "0";
  289. fobj.frameBorder = 0;
  290. fobj.marginWidth = 0;
  291. fobj.marginHeight = 0;
  292. fobj.vspace = 0;
  293. fobj.hspace = 0;
  294. fobj.scrolling = "no";
  295. fobj.setAttribute("class", "chitikaAdBlock");
  296. fobj.width = d[0];
  297. fobj.height = d[1];
  298. f.parentNode.insertBefore(fobj,f);
  299. }
  300. if (w["ch_render_fallback"]) {
  301. return w.ch_render_fallback(r);
  302. }
  303. }
  304. }
  305. function ch_mm() {
  306. var w = window;
  307. if (w.ch_client == 'byethost11') {
  308. return;
  309. }
  310. if (w.ch_unit_id === undefined) {
  311. w.ch_unit_id = 0;
  312. }
  313. else {
  314. w.ch_unit_id++;
  315. }
  316. w.ch_host = ch_def(w.ch_host, 'mm.chitika.net');
  317. w.ch_ad_url = 'http://' + w.ch_host + '/minimall?';
  318. w.ch_impsrc = ch_def(w.ch_impsrc, 'amm');
  319. // Detect iframes and pass appropriate frm & url values
  320. var serveUrl = null;
  321. try {
  322. // Are win in an iframe?
  323. if (w.top.document.location.href == document.location.href) {
  324. // Nope. Nothing special here to do.
  325. if (w.ch_pu) {
  326. ch_aue('dcc2', '1');
  327. } else {
  328. w.ch_pu = document.location.href;
  329. }
  330. w.ch_referrer = document.referrer;
  331. } else {
  332. // Yes, we are
  333. ch_aue('frm', 1);
  334. w.ch_pu = w.top.document.location.href;
  335. w.ch_referrer = w.top.document.referrer;
  336. serveUrl = document.location.href;
  337. }
  338. } catch (x) { // Security exception
  339. // Security problem. Try something else. Hope this works...
  340. ch_aue('frm', 2);
  341. w.ch_pu = document.referrer;
  342. serveUrl = document.location.href;
  343. }
  344. if (serveUrl !== null &&
  345. !serveUrl.match(/^javascript:/)) {
  346. ch_aue('serveUrl', serveUrl);
  347. }
  348. var m = String(w.location.href).match(/#chitikatest(?:=(.+))?/);
  349. if (m) {
  350. var q = m[1];
  351. if (q == undefined) { q = 'mortgage'; }
  352. w.ch_referrer = "http://www.google.com/search?q="+q;
  353. ch_au('ip', 'us');
  354. ch_au('test', '1');
  355. }
  356. if (w.ch_client == 'epodunk') {
  357. ch_aue('dcc1', '2');
  358. if (m = w.location.hostname.match(/([^\.]+)\.(com|net|org|info|mobi|co\.uk|org\.uk|ac\.uk|uk)$/)) {
  359. w.ch_sid = 'epodunk_' + m[1];
  360. }
  361. }
  362. if (w.ch_client.match(/^epodunk_/)) {
  363. w.ch_sid = w.ch_client;
  364. w.ch_client = 'epodunk';
  365. }
  366. ch_screen = "" + screen.width + "x" + screen.height;
  367. // Get window size and visible page size; accessed differently for MSIE vs. standards-compliant browsers
  368. try{
  369. if (navigator.appName.indexOf("Microsoft") !== -1 &&
  370. navigator.userAgent.match(/MSIE ([^\.]+)/)[1]*1 < 9) {
  371. ch_window = document.documentElement.clientWidth + "x" + document.documentElement.clientHeight;
  372. ch_canvas = document.body.clientWidth + "x" + document.body.clientHeight;
  373. } else {
  374. ch_window = window.innerWidth + "x" + window.innerHeight;
  375. ch_canvas = document.body.clientWidth + "x" + document.body.clientHeight;
  376. }
  377. }catch(e){}
  378. // Get Configuration ID; default to unit-N or SID, if unavailable
  379. if (!w.ch_cid) {
  380. if (!w.ch_sid ||
  381. w.ch_sid == 'Chitika Default') {
  382. w.ch_cid = 'unit-'+w.ch_unit_id;
  383. }
  384. else {
  385. w.ch_cid = w.ch_sid;
  386. }
  387. }
  388. ch_aue('w', w.ch_width);
  389. ch_aue('h', w.ch_height);
  390. ch_aue('client', w.ch_client);
  391. ch_aue('sid', w.ch_sid);
  392. ch_aun('cid', w.ch_cid);
  393. ch_aue('nump', w.ch_nump);
  394. ch_aue('query', w.ch_query);
  395. if (w.ch_type) {
  396. ch_aue('type', w.ch_type);
  397. if (w.ch_queries && w.ch_queries.constructor.toString().indexOf("Array") != -1) {
  398. ch_aue('mquery', w.ch_queries.join('|'));
  399. } else if (w.ch_query) {
  400. ch_aue('mquery', w.ch_query);
  401. }
  402. }
  403. ch_aue('tptracker', w.ch_third_party_tracker);
  404. ch_aue('cttarget', w.ch_target);
  405. ch_aue('noborders', w.ch_noborders);
  406. ch_aue('cl_border', w.ch_color_border);
  407. ch_aue('cl_bg', w.ch_color_bg);
  408. ch_aue('cl_title', w.ch_color_title);
  409. ch_aue('cl_text', w.ch_color_text);
  410. ch_aue('cl_site_link', w.ch_color_site_link);
  411. ch_aue('fn_title', w.ch_font_title);
  412. ch_aue('fn_text', w.ch_font_text);
  413. ch_aue('alturl', w.ch_alternate_ad_url);
  414. ch_aue('altcss', w.ch_alternate_css_url);
  415. ch_aue('behavioral_window', w.ch_behavioral_window);
  416. ch_aue('previous_format',w.ch_previous_format);
  417. ch_aue('must_fill',w.ch_must_fill);
  418. ch_aue('select',w.ch_select);
  419. ch_aue('screenres', w.ch_screen);
  420. ch_aue('winsize', w.ch_window);
  421. ch_aue('canvas', w.ch_canvas);
  422. ch_aue('mobile', w.ch_mobile);
  423. ch_aue('where', w.ch_where);
  424. ch_aue('history', history.length);
  425. ch_aue('metro_id', w.ch_metro_id);
  426. ch_aue('city', w.ch_city);
  427. ch_aue('state', w.ch_state);
  428. ch_aue('zip', w.ch_zip);
  429. ch_aue('impsrc', w.ch_impsrc);
  430. ch_aue('vsn', ch_amm_version);
  431. ch_aue('url', w.ch_pu);
  432. ch_aue('ref', w.ch_referrer);
  433. ch_aue('cat_id', w.ch_cat_id);
  434. ch_aue('dpr', w.devicePixelRatio);
  435. if (w.ch_demo_mode == 1) {
  436. ch_au('ip', '71.248.173.210');
  437. ch_au('demomode', '1');
  438. }
  439. if (navigator.userAgent.match(/Chrome/) &&
  440. document.webkitVisibilityState !== undefined &&
  441. document.webkitVisibilityState == "prerender") {
  442. ch_au('prerender', 1);
  443. }
  444. if (document.location.href.indexOf('##chitika_ab=') !== -1) {
  445. ch_au('ab_overlay_which', document.location.href.match(/##chitika_ab=([^&]+)/)[1]);
  446. }
  447. var r = Math.round(Math.random() * 1000);
  448. ch_au('cb', r);
  449. ch_get_snippet();
  450. if (w.ch_dim === undefined) {
  451. w.ch_dim = {};
  452. }
  453. if (w.ch_bright === undefined) {
  454. w.ch_bright = {};
  455. }
  456. // For list units we pass a string for height, which IE just hates. So, if we're passing a string, we'll fake it out
  457. // by passing 0. Height is resized by fluidH anyway.
  458. _dHeight = (typeof(w.ch_height) == "string" || typeof(w.ch_height) == "undefined") ? 0 : w.ch_height;
  459. w.ch_dim["ch_ad"+r] = [
  460. w.ch_width,
  461. _dHeight,
  462. w.ch_alternate_js_callback,
  463. undefined,
  464. undefined,
  465. undefined,
  466. w.ch_fluidW,
  467. w.ch_fluidH
  468. ];
  469. w.ch_bright['ch_ad'+r] = {
  470. client: w.ch_client,
  471. cid: w.ch_cid,
  472. width: w.ch_width,
  473. height: _dHeight,
  474. altjscb: w.ch_alternate_js_callback,
  475. fluidW: w.ch_fluidW,
  476. fluidH: w.ch_fluidH
  477. };
  478. if (w.ch_previous_format){
  479. w.ch_previous_format = w.ch_previous_format + "," + w.ch_width + "x" + w.ch_height;
  480. } else {
  481. w.ch_previous_format = w.ch_width + "x" + w.ch_height;
  482. }
  483. document.write('<div id="chitikaAdBeacon-'+r+'"></div>');
  484. var adBeacon = document.getElementById("chitikaAdBeacon-"+r);
  485. var adLoc = ch_ad_locate(adBeacon);
  486. ch_aue("loc", adLoc.x + "," + adLoc.y);
  487. w.ch_ad_url = w.ch_ad_url.substring(0, 2048);
  488. w.ch_ad_url = w.ch_ad_url.replace(/%\w?$/, '');
  489. w.ch_ad_url += "&output=simplejs&callback=ch_ad_render_search";
  490. if (w.ch_hq){
  491. var s = ch_add_script('http://tags.chitika.net/hq/'+w.ch_client+'.js');
  492. s.ch_ad_url = w.ch_ad_url;
  493. s._fired = false;
  494. try {
  495. s.onload = function() {
  496. if(this._fired) return;
  497. ch_real_ad_url = this.ch_ad_url;
  498. ch_hq_execute();
  499. this._fired = true;
  500. }
  501. s.onreadystatechange = function() {
  502. if(this._fired) return;
  503. if(this.readyState == "complete" || this.readyState == "loaded") {
  504. ch_real_ad_url = this.ch_ad_url;
  505. ch_hq_execute();
  506. this._fired = true;
  507. }
  508. }
  509. }catch(e){}
  510. } else {
  511. ch_add_script(w.ch_ad_url);
  512. }
  513. if(!w.ch_ad_urls) w.ch_ad_urls = [];
  514. w.ch_ad_urls['ch_ad'+r] = w.ch_ad_url;
  515. w.ch_last_ad_url = w.ch_ad_url;
  516. w.ch_ad_url = "about:blank";
  517. document.write('<ifr' + 'ame' + ' id="ch_ad'+r+'" name="ch_ad'+r+'"' + ' width="0" height="0" frameborder="0"' + ' src=' + dq(w.ch_ad_url) + ' marginwidth="0"' + ' marginheight="0"' + ' vspace="0"' + ' hspace="0"' + ' allowtransparency="true"' + ' scrolling="no">' + '</ifr' + 'ame>');
  518. ch_clear();
  519. }
  520. function ex_normal_op(){
  521. ch_add_script(window.ch_real_ad_url);
  522. }
  523. function ch_clear() {
  524. var w = window;
  525. //w.ch_ad_url = undefined;
  526. w.ch_alternate_ad_url = undefined;
  527. w.ch_alternate_css_url = undefined;
  528. w.ch_append_tracking = undefined;
  529. w.ch_behavioral_window = undefined;
  530. w.ch_cat_id = undefined;
  531. w.ch_cid = undefined;
  532. w.ch_city = undefined;
  533. w.ch_fluidH = undefined;
  534. w.ch_fluidW = undefined;
  535. w.ch_height = undefined;
  536. w.ch_host = undefined;
  537. w.ch_impsrc = undefined;
  538. w.ch_metro_id = undefined;
  539. w.ch_must_fill = undefined;
  540. w.ch_noborders = undefined;
  541. w.ch_nump = undefined;
  542. w.ch_query = undefined;
  543. w.ch_select = undefined;
  544. w.ch_sid = undefined;
  545. w.ch_state = undefined;
  546. w.ch_type = undefined;
  547. w.ch_where = undefined;
  548. w.ch_width = undefined;
  549. w.ch_zip = undefined;
  550. }
  551. ch_mm();

comments powered by Disqus