How to use wt method in wpt

Best JavaScript code snippet using wpt

controller_v1.1.js

Source:controller_v1.1.js Github

copy

Full Screen

1/*2 * $Id: controller_v1.1.js 103281 2012-07-11 16:14:19Z konige $3 * (c) 2006-2010 The New York Times Company4 */5// SET GLOBAL VARS6var nyt_url = document.URL;7var nyt_domain = document.domain;8var nyt_path = window.location.pathname;9var wt_dcsidArray = {"General":"dcsym57yw10000s1s8g0boozt_9t1x",10 "Homepage":"dcsa5pgfq10000c9zuysqk0lm_6i8y",11 "World":"dcspjt2na00000wcnvo8wdaeo_7q9o",12 "U.S.":"dcsypfq3j00000gsclwfljaeo_6i3w",13 "Politics":"dcsa23rmv10000wowiejpwx86_4v7j",14 "N.Y./Region":"dcsj5tb4n100000sl76culaeo_4f3w",15 "Business":"dcsc32upj10000c58n7kgpaeo_8i3g",16 "Technology":"dcs591klg00000c97pblfraeo_7p3p",17 "Science":"dcsaon9rw0000008ifmgqtaeo_2f9c",18 "Health":"dcsfj6l0t100008ijt0irzaeo_2k8f",19 "Sports":"dcss4vytr000000kbuy6j8beo_6f7s",20 "Opinion":"dcs5ydwfq100008me456mabeo_1z2v",21 "Books":"dcss90tjf00000knzmux6hbeo_8r8y",22 "Dance":"dcs9ihxq600000w842mebkbeo_9r6q",23 "Movies":"dcsyoaqvl00000wc34qfambeo_4q3b",24 "Music":"dcsrioyse100000kjghaqubeo_2d4x",25 "TV":"dcsghn1j900000gs8yfgfwbeo_3r9l",26 "Theater":"dcsxl9f4810000oub8mfiybeo_5l8v",27 "Arts":"dcsnu1k8n00000oi2prv9fbeo_2w5s",28 "T:Style":"dcs31c2fd10000w8wjmo22ceo_5x6n",29 "Style":"dcs2dla2i00000431qkl70ceo_3j4r",30 "Travel":"dcsktwey810000kfp9nsv3ceo_6n1r",31 "Jobs":"dcsxmnyde100000oerlyk5ceo_6k5k",32 "Real Estate":"dcsuvvccp000000sdtpzj7ceo_3j2x",33 "Great Homes":"dcszwassu10000w8cogv42y86_8h8v",34 "Autos":"dcs3i2ttw0000043xyk839ceo_2v6n",35 "Classifieds":"dcso5eb2r10000cpz9bq5cceo_3j5e",36 "Video":"dcs1j460r100008uw7es2eceo_6c4w",37 "TimesSelect":"dcsqdkcdj100004zt5huzfceo_3b7v",38 "Times Topics":"dcs3baftr1000008q5oxvjceo_4r9g",39 "Member Center":"dcst9xior10000wo45l9anceo_4u9e",40 "Crosswords/Games":"dcsepujaa100000s5bq9bpceo_7w6k",41 "Sunday Magazine":"dcsrmsj6n10000wok933qrceo_1x8d",42 "Most Popular":"dcsvmgcs910000o2ubv1z1deo_8b5s",43 "Learning Network":"dcslh0e4x00000ggzmnn3ldeo_6f8k",44 "Knowledge Network":"dcs69r7oi100004nscorwmdeo_7r4i",45 "Week In Review":"dcsvfceih10000o610i65qdeo_7y5r",46 "Weather":"dcsker4wf10000wszj8b32eeo_4m7u",47 "News Tracker":"dcsa1h2mn00000oacf4of5eeo_5f2m",48 "Multimedia":"dcsvs34dy000000chtbmk7eeo_3f9p",49 "Cartoons / Humor":"dcsc1dh4600000oiajcqd9eeo_9l2m",50 "Cartoons":"dcsc1dh4600000oiajcqd9eeo_9l2m",51 "AP/Reuters":"dcs15dnk9100004r7jamfwu0p_3v8n",52 "Search":"dcsmcntzl00000wwyhty30deo_8o2v",53 "Blogrunner":"dcs9rqdr610000082j6e7xceo_1c8r",54 "MyTimes":"dcsctlxlp10000chdjl4jlceo_2d1n",55 "Times File":"dcs91tz2300000c1p17hs3eeo_4o7e",56 "Email This":"dcsy6xxc210000g07639fkkvs_7b7o",57 "Archive":"dcssxc7tw10000ggrcqca1cbr_1v1i",58 "Olympics":"dcs3oivag100004zd9xgx1mfh_4f9w",59 "Widget":"dcsoy2de300000ch9g4qg9oct_9j4x",60 "Self Service":"dcs1tovv3100004rjcdl3h79j_7p9f",61 "Home Delivery Acquisition":"dcsio1db9100004n4exgb9o0q_6o3k",62 "Home Delivery":"dcsbnggae10000kbq7blis7nn_6g9j",63 "Digital Subscription":"dcsv96qcv000008alp4trgo0q_7h8h"};64var wt_cgArray = {"aponline":"AP/Reuters",65 "arts":"Arts",66 "automobiles":"Autos",67 "books":"Books",68 "business":"Business",69 "Business Day":"Business",70 "crosswords":"Crosswords/Games",71 "dining":"Style",72 "education":"U.S.",73 "fashion":"Style",74 "garden":"Style",75 "greathomesanddestinations":"Great Homes",76 "health":"Health",77 "jobs":"Jobs",78 "magazine":"Sunday Magazine",79 "movies":"Movies",80 "multimedia":"General",81 "nyregion":"N.Y./Region",82 "olympics":"Olympics",83 "opinion":"Opinion",84 "podcasts":"General",85 "publiceditor":"Opinion",86 "realestate":"Real Estate",87 "reuters":"AP/Reuters",88 "science":"Science",89 "sports":"Sports",90 "style":"Style",91 "t-magazine":"T:Style",92 "technology":"Technology",93 "theater":"Theater",94 "timestopics":"Times Topics",95 "todayspaper":"General",96 "travel":"Travel",97 "us":"U.S.",98 "washington":"U.S.",99 "weekinreview":"Week in Review",100 "world":"World"};101var wt_scgArray = {"design":"Art and Design",102 "boxoffice":"Box Office",103 "autoreviews":"New Cars",104 "collectibles":"Collectibles",105 "review":"Sunday Book Review",106 "bestseller":"Best-Seller Lists",107 "chapters":"First Chapters",108 "media":"Media and Advertising",109 "worldbusiness":"World Business",110 "smallbusiness":"Small Business",111 "yourmoney":"Your Money",112 "research":"Research",113 "nutrition":"Fitness and Nutrition",114 "policy":"Money and Policy",115 "views":"Views",116 "guide":"Health Guide",117 "currentreleases":"In Theaters",118 "homevideo":"On DVD",119 "criticspicks":"Critics Pick",120 "thecity":"The City",121 "nyregionspecial2":"The Region",122 "nyregionopinions":"NY/Region Opinions",123 "earth":"Environment",124 "space":"Space and Cosmos",125 "baseball":"Baseball",126 "football":"Pro Football",127 "ncaafootball":"College Football",128 "basketball":"Pro Basketball",129 "ncaabasketball":"College Basketball",130 "hockey":"Hockey",131 "soccer":"Soccer",132 "golf":"Golf",133 "tennis":"Tennis",134 "othersports":"Other Sports",135 "fashion":"Fashion",136 "dining":"Dining",137 "garden":"Home and Garden",138 "weddings":"Weddings",139 "tmagazine":"T Magazine",140 "personaltech":"Personal Tech",141 "broadway":"Broadway",142 "offbroadway":"Off Broadway",143 "offoffbroadway":"Off Off Broadway",144 "london":"London",145 "reviews":"Reviews",146 "washington":"Washington",147 "education":"Education",148 "africa":"Africa",149 "americas":"Americas",150 "asia":"Asia Pacific",151 "europe":"Europe",152 "middleeast":"Middle East",153 "editorials":"Editorials",154 "contributors":"Contributors",155 "nyregionopinions":"NY/Region Opinions",156 "communities":"Communities",157 "commercial":"Commercial",158 "podcasts":"Podcasts",159 "womens-fashion":"Women's Fashion",160 "mens-fashion":"Men's Fashion",161 "design":"Design",162 "travel":"Travel",163 "food":"Food",164 "culture":"Culture",165 "dealbookjobs":"Dealbook Jobs"};166// POPULATE META TAGS167// Get content group168var wt_contentGroup = getMetaTag("WT.cg_n");169var wt_cgTag;170if (wt_contentGroup == "") {171 wt_cgTag = getMetaTag("CG");172 wt_tempcontentGroup = wt_cgArray[wt_cgTag];173 if (wt_tempcontentGroup != undefined) {174 wt_contentGroup = wt_tempcontentGroup;175 } else {176 wt_contentGroup = wt_cgTag;177 }178 if (wt_contentGroup == "") {179 wt_contentGroup = getContentGroup(nyt_url, nyt_domain, nyt_path);180 }181}182// Get subcontent group183setSubcontentGroupByOC();184wt_scgTag = getMetaTag("SCG");185wt_tempsubcontentGroup = wt_scgArray[wt_scgTag];186if (wt_tempsubcontentGroup != undefined) {187 wt_scgTag = wt_tempsubcontentGroup; 188}189wt_subcontentGroup = wt_scgTag;190// Update content and subcontent groups 191handleCGExceptions();192addMetaTag("WT.cg_n", wt_contentGroup);193addMetaTag("WT.cg_s", wt_subcontentGroup);194//set flags for registration tagging195setRegistrationSection();196// Read generic tags from page197readPageTags();198// Get content specific info199setContentInfo();200// Set referrer info201setReferrerInfo();202// Set Section Front203setSectionFront();204// Set gdcsid (default to General if there is no match)205gdcsid = wt_dcsidArray[wt_contentGroup];206if (gdcsid == undefined) {207 gdcsid = "dcsym57yw10000s1s8g0boozt_9t1x";208}209// Set dcsvid210var dcsvid;211if (dcsvid != undefined && dcsvid != "0") {212 addMetaTag("WT.dcsvid", dcsvid);213}214// Set registration status215var regstatus;216if (regstatus != undefined) {217 addMetaTag("WT.rv", (regstatus == "registered") ? "1" : "0");218}219// Set article information220var metaArticleId = getMetaTag("articleid");221if (metaArticleId != "" && getMetaTag("WT.z_gpst") != "Comments Overflow") {222 setArticleInfo(metaArticleId);223} else {224 setCommentOverflowInfo(metaArticleId);225}226// Set pub date range; NB - this needs to be after setArticleInfo227var pub_date = getMetaTag("WT.z_pud");228if (pub_date != "") {229 setPubDateInfo(pub_date);230}231// Set interactive information232var tomMetaTag = getMetaTag("tom");233if (tomMetaTag == "interactive_graphic" || tomMetaTag == "interactive_feature") {234 setInteractiveGraphicInfo();235}236// Set imagepages 237if (/^\/imagepages/.test(nyt_path)) {238 addMetaTag("PT", "Multimedia");239 addMetaTag("PST", "Image");240}241// Set slideshow information242var tomMetaTag = getMetaTag("tom");243if ((tomMetaTag == "Slideshow") || (/^\/slideshow\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\//.test(nyt_path))) {244 setSlideshowInfo();245}246// set Sunday Review info247if ((/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/sunday-review\//.test(nyt_path)) || 248 (/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/opinion\/sunday\//.test(nyt_path))) {249 setSundayReviewInfo();250}251// Set campaign information252var metaEmailCampId = getQueryParameter("emc");253addMetaTag("WT.mc_id", metaEmailCampId);254var externalCampId = getQueryParameter("excamp");255if (externalCampId != "") {256 addMetaTag("WT.mc_id", externalCampId);257 addMetaTag("WT.srch", "1");258}259if (getMetaTag("WT.mc_id") != "") {260 addMetaTag("WT.mc_ev", "click"); 261}262// Set no_interstitial param263if (queryParameterExists("no_interstitial")) {264 addMetaTag("WT.z_dirlnk", "1");265}266// Set global cookie tracking info267if (/NYT-Global/.test(document.cookie)) {268 addMetaTag("WT.gv", "2");269}270else if (/edition\|GLOBAL/.test(document.cookie)) {271 addMetaTag("WT.gv", "1");272}273// check homepage auto refresh cookie274if (document.cookie.match(/autorefresh=1/)) {275 addMetaTag("WT.z_jog", "1");276 var expTime = new Date();277 expTime.setTime(expTime.getTime() - 60000);278 document.cookie = "autorefresh=0; expires=" + expTime.toGMTString() + "; path=/";279}280// Set the click tracking variable for specific pages281setTrackEvents();282// Set onsite search information283setSearchInfo();284// Set default information285setDefaultTags();286// Include WebTrends wtinit.js287var wtinitFile = js_host+"wtinit.js";288includeFile(wtinitFile);289// Include WebTrends wtbase.js290var wtbaseFile = js_host+"wtbase.js";291includeFile(wtbaseFile);292// FUNCTIONS293function setRegistrationSection(){294 var section = getMetaTag("WT.cg_n");295 switch(section) {296 case "Member Center": break; //do nothing297 case "Digital Subscription": break; //do nothing298 default:299 addMetaTag("WT.z_rcgn", section);300 addMetaTag("WT.z_rcgs", getMetaTag("WT.cg_s"));301 } 302}303 /**304 * When OC is present, default SCG to NYT, 305 * set to IHT for specific OCs 306 */307function setSubcontentGroupByOC() {308 309 if (getQueryParameter("OC") == '') {310 return false; 311 }312 313 // hardcoded as per bugzilla-58282314 var globalOCs = ['4285135516', '1803925390', '1873190447'];315 316 for (i in globalOCs) {317 if (globalOCs[i] == getQueryParameter("OC")) {318 overwriteMetaTag("SCG", "IHT");319 }320 }321 322 if (getMetaTag("SCG") == '') {323 overwriteMetaTag("SCG", "NYT");324 }325 326}327function getContentGroup(wt_url, wt_domain, wt_path) {328 var contentGroup = getMetaTag("contentGroup");329 if (contentGroup == "") {330 // homepage331 if(/^http:\/\/(www\.)?(nytimes|times)\.com\/(\/|index\.html|pages\/|pages\/partners\/aol\/homepage\/|yr\/mo\/day\/)?$/.test(wt_url)) {332 contentGroup = "Homepage";333 // world334 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/\b(world|international)\b\//.test(wt_path)335 || /^\/international\//.test(wt_path)336 || /\/packages\/html\/\b(world|international)\b\//.test(wt_path)337 || /^\/\b(pages|ref|reuters|aponline|cfr)\b\/world\//.test(wt_path)) {338 contentGroup = "World";339 // politics340 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/\b(us\/politics|politics)\b\//.test(wt_path)341 || /\/packages\/html\/politics\//.test(wt_path)342 || /^\/pages\/politics\//.test(wt_path)343 || /^\/yr\/mo\/day\/politics\//.test(wt_path)344 || /^\/politics\//.test(wt_path)345 || /^\/ref\/politics\//.test(wt_path)346 || /^\/ref\/us\/politics\//.test(wt_path)347 || /\/election-guide\//.test(wt_path)) {348 contentGroup = "Politics";349 // us350 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/\b(us|education|washington|national)\b\//.test(wt_path)351 || /\/packages\/html\/\b(us|education|washington|national)\b\//.test(wt_path)352 || /^\/pages\/\b(us|education|washington|national)\b\//.test(wt_path)353 || /^\/yr\/mo\/day\/\b(us|education|washington|national)\b\//.test(wt_path)354 || /^\/\b(us|education|washington|national)\b\//.test(wt_path)355 || /^\/aponline\/us\//.test(wt_path)356 || /^\/reuters\/us\//.test(wt_path)357 || /^\/ref\/\b(us|education|washington|national)\b\//.test(wt_path)358 || /^\/cq\//.test(wt_path)) {359 contentGroup = "U.S.";360 // ny region - check this before opinion361 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/nyregion\//.test(wt_path)362 || /^\/packages\/khtml\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/nyregion\//.test(wt_path)363 || /\/packages\/html\/nyregion\//.test(wt_path)364 || /^\/pages\/nyregion\//.test(wt_path)) {365 contentGroup = "N.Y./Region";366 // business367 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/business\//.test(wt_path)368 || /\/packages\/html\/business\//.test(wt_path)369 || /^\/pages\/business\//.test(wt_path)370 || /^\/yr\/mo\/day\/business\//.test(wt_path)371 || /^\/business\//.test(wt_path)372 || /^\/aponline\/business\//.test(wt_path)373 || /^\/reuters\/business\//.test(wt_path)374 || /^\/ref\/business\//.test(wt_path)375 || /^\/allbusiness\//.test(wt_path)376 || /^\/inc_com\//.test(wt_path)) {377 contentGroup = "Business";378 // technology379 } else if (wt_domain == "tech.nytimes.com"380 || wt_domain == "tech2.nytimes.com"381 || wt_domain == "download.nytimes.com" 382 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/technology\//.test(wt_path)383 || /\/packages\/html\/technology\//.test(wt_path)384 || /^\/pages\/technology\//.test(wt_path)385 || /^\/tech\//.test(wt_path)386 || /^\/aponline\/technology\//.test(wt_path)387 || /^\/reuters\/technology\//.test(wt_path)388 || /^\/ref\/technology\//.test(wt_path)389 || /^\/pages\/cnet\//.test(wt_path)390 || /^\/cnet\//.test(wt_path)391 || /^\/paidcontent\//.test(wt_path)392 || /^\/idg\//.test(wt_path)393 || (/^\/gst\/fullpage\.html/.test(wt_path) && getQueryParameter("sec") == "technology")) {394 contentGroup = "Technology";395 // science396 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/science\//.test(wt_path)397 || /\/packages\/html\/science\//.test(wt_path)398 || /^\/ref\/science\//.test(wt_path)399 || /^\/pages\/science\//.test(wt_path)) {400 contentGroup = "Science";401 402 // health403 } else if (wt_domain == "health.nytimes.com"404 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/health\//.test(wt_path)405 || /\/packages\/html\/health\//.test(wt_path)406 || /^\/pages\/health\//.test(wt_path)407 || /^\/aponline\/health\//.test(wt_path)408 || /^\/reuters\/health\//.test(wt_path)409 || /^\/ref\/health\//.test(wt_path)) {410 contentGroup = "Health";411 412 // sports413 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/sports\//.test(wt_path)414 || /\/packages\/html\/sports\//.test(wt_path)415 || /^\/yr\/mo\/day\/sports\//.test(wt_path)416 || /^\/sports\//.test(wt_path)417 || /^\/pages\/sports\//.test(wt_path)418 || /^\/aponline\/sports\//.test(wt_path)419 || /^\/reuters\/sports\//.test(wt_path)) {420 contentGroup = "Sports";421 422 // opinion423 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/opinion\//.test(wt_path)424 || /\/packages\/html\/opinion\//.test(wt_path)425 || /^\/pages\/opinion\//.test(wt_path)426 || /^\/pages\/readersopinions\//.test(wt_path)427 || /^\/opinion\//.test(wt_path)428 || /^\/top\/opinion\//.test(wt_path)429 || /^\/ref\/opinion\//.test(wt_path)) {430 contentGroup = "Opinion";431 432 // books433 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/books\//.test(wt_path)434 || /\/packages\/html\/books\//.test(wt_path)435 || /^\/pages\/books\//.test(wt_path)436 || /^\/ref\/books\//.test(wt_path)) {437 contentGroup = "Books";438 // dance439 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/arts\/dance\//.test(wt_path)440 || /\/packages\/html\/dance\//.test(wt_path)441 || /^\/pages\/arts\/dance\//.test(wt_path)) {442 contentGroup = "Dance";443 // movies444 } else if (wt_domain == "movies.nytimes.com"445 || wt_domain == "movies2.nytimes.com"446 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/movies\//.test(wt_path)447 || /\/packages\/html\/movies\//.test(wt_path)448 || /^\/pages\/movies\//.test(wt_path)449 || /^\/ref\/movies\//.test(wt_path)) {450 contentGroup = "Movies";451 // music452 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/arts\/music\//.test(wt_path)453 || /\/packages\/html\/music\//.test(wt_path)454 || /^\/pages\/arts\/music\//.test(wt_path)) {455 contentGroup = "Music";456 // television457 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/arts\/television\//.test(wt_path)458 || /\/packages\/html\/television\//.test(wt_path)459 || /^\/pages\/arts\/television\//.test(wt_path)) {460 contentGroup = "TV";461 462 // theater463 } else if (wt_domain == "theater.nytimes.com"464 || wt_domain == "theater2.nytimes.com"465 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/theater\//.test(wt_path)466 || /\/mem\/theater\//.test(wt_path)467 || /\/mem\/ticketwatch\.html/.test(wt_path)468 || /\/packages\/html\/theater\//.test(wt_path)469 || /^\/pages\/theater\//.test(wt_path)470 || /^\/readersreviews\/theater\//.test(wt_path)) {471 contentGroup = "Theater";472 // art - must appear after its subsections473 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/arts\//.test(wt_path)474 || /\/packages\/html\/arts\//.test(wt_path)475 || /^\/aponline\/arts\//.test(wt_path)476 || /^\/reuters\/arts\//.test(wt_path)477 || /^\/pages\/arts\//.test(wt_path)) {478 contentGroup = "Arts";479 // tstyle - check this before style480 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/style\/\b(t|tmagazine)\b\//.test(wt_path)481 || /^\/pages\/style\/(t|tmagazine)\//.test(wt_path)) {482 contentGroup = "T:Style";483 484 // style485 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/\b(style|fashion|dining|garden)\b\//.test(wt_path)486 || /\/packages\/html\/\b(style|fashion|dining|garden)\b\//.test(wt_path)487 || /^\/pages\/\b(style|fashion|dining|garden)\b\//.test(wt_path)488 || /^\/ref\/fashion\//.test(wt_path)) {489 contentGroup = "Style";490 // travel491 } else if (wt_domain == "travel.nytimes.com"492 || wt_domain == "travel2.nytimes.com"493 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/travel\//.test(wt_path)494 || /^\/pages\/travel\//.test(wt_path)495 || /^\/travel\//.test(wt_path)496 || /^\/map\/travel\//.test(wt_path)497 || /^\/packages\/html\/travel\//.test(wt_path)498 || /^\/gst\/travel\/travsearch\.html/.test(wt_path)499 || (/^\/gst\/fullpage\.html/.test(wt_path) && getQueryParameter("sec") == "travel")) {500 contentGroup = "Travel";501 502 // jobs503 } else if (wt_domain == "jobmarket.nytimes.com"504 || wt_domain == "salary.nytimes.com"505 || /\/packages\/html\/jobs\//.test(wt_path)506 || /^\/pages\/jobs\//.test(wt_path)507 || /^\/marketing\/jobmarket\//.test(wt_path)) {508 contentGroup = "Jobs";509 510 // greathomes511 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/\b(realestate\/greathomes|greathomesanddestinations)\b\//.test(wt_path)512 || /^\/pages\/great-homes-and-destinations\//.test(wt_path)513 || /^\/pages\/greathomes\//.test(wt_path)514 || /^\/top\/great-homes-and-destinations\//.test(wt_path)) {515 contentGroup = "Real Estate";516 // realestate517 } else if (wt_domain == "realestate.nytimes.com"518 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/realestate\//.test(wt_path)519 || /\/packages\/html\/realestate\//.test(wt_path)520 || /^\/pages\/realestate\//.test(wt_path)521 || /^\/ref\/realestate\//.test(wt_path)) {522 contentGroup = "Real Estate";523 // autos524 } else if (wt_domain == "autos.nytimes.com"525 || wt_domain == "collectiblecars.nytimes.com"526 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/automobiles\//.test(wt_path)527 || /^\/pages\/automobiles\//.test(wt_path)528 || /^\/ref\/automobiles\//.test(wt_path)529 || /^\/automobiles\//.test(wt_path)530 || /^\/autos\//.test(wt_path)531 || /^\/packages\/html\/automobiles\//.test(wt_path)) {532 contentGroup = "Autos";533 // search 534 } else if (/^\/search\/query/.test(wt_path)) {535 contentGroup = "Search";536 // classifieds537 } else if (wt_domain == "listings.nytimes.com"538 || wt_domain == "placead.nytimes.com"539 || /^\/top\/classifieds\//.test(wt_path)540 || /^\/gst\/personals.html/.test(wt_path)) {541 contentGroup = "Classifieds";542 // video543 } else if (wt_domain == "video.on.nytimes.com") {544 contentGroup = "Video";545 // timestopics546 } else if (/^\/top\/reference\/timestopics\//.test(wt_path)547 || /^\/top\/news\/business\//.test(wt_path)548 || /^\/top\/news\/international\//.test(wt_path)549 || /^\/top\/news\/national\//.test(wt_path)550 || /^\/top\/classifieds\/realestate\//.test(wt_path)) {551 contentGroup = "Times Topics";552 // email this553 } else if (/^\/mem\/emailthis.html/.test(wt_path)) {554 contentGroup = "Email This";555 // newstracker 556 } else if (/^\/mem\/tnt.html/.test(wt_path)) {557 contentGroup = "News Tracker";558 // crosswordsgames559 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/crosswords\//.test(wt_path)560 || /^\/pages\/crosswords\//.test(wt_path)561 || /^\/ref\/crosswords\//.test(wt_path)562 || /^\/premium\/xword\//.test(wt_path)563 || /^\/premiumproducts\/crosswords\/index.html/.test(wt_path)) {564 contentGroup = "Crosswords/Games";565 // sundaymagazine566 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/magazine\//.test(wt_path)567 || /^\/pages\/magazine\//.test(wt_path)568 || /^\/ref\/magazine\//.test(wt_path)569 || /^\/packages\/html\/magazine\//.test(wt_path)) {570 contentGroup = "Sunday Magazine";571 // mostpopular 572 } else if (/^\/most-(popular|popular-searched|popular-movies|popular-emailed|popular-viewed|popular-blogged)\//.test(wt_path)) {573 contentGroup = "Most Popular"; 574 // learningnetwork575 } else if (/^\/learning\//.test(wt_path)576 || /\/packages\/html\/learning\//.test(wt_path)) {577 contentGroup = "Learning Network";578 // knowledgenetwork579 } else if (wt_domain == "college.nytimes.com"580 || /\/packages\/html\/college\//.test(wt_path)581 || /^\/college\//.test(wt_path)582 || /\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/college\//.test(wt_path)) {583 contentGroup = "Knowledge Network";584 // weekinreview585 } else if (/\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/weekinreview\//.test(wt_path)586 || /\/packages\/html\/weekinreview\//.test(wt_path)587 || /^\/pages\/weekinreview\//.test(wt_path)588 || /^\/weekinreview\//.test(wt_path)) {589 contentGroup = "Week In Review";590 // weather591 } else if (/^\/gst\/weather.html/.test(wt_path)592 || /^\/mem\/weather.html/.test(wt_path)593 || /\/packages\/html\/weather\//.test(wt_path)594 || /^\/weather/.test(wt_path)) {595 contentGroup = "Weather";596 // multimedia597 } else if (/^\/pages\/multimedia\//.test(wt_path)598 || /\/packages\/html\/multimedia\//.test(wt_path)599 || /^\/ref\/multimedia\//.test(wt_path)) {600 contentGroup = "Multimedia";601 // cartoons602 } else if (/^\/pages\/cartoons\//.test(wt_path)603 || /\/packages\/html\/cartoons\//.test(wt_path)) {604 contentGroup = "Cartoons";605 606 // apreuters607 } else if (/^\/pages\/\b(aponline|reuters)\b\//.test(wt_path)) {608 contentGroup = "AP/Reuters";609 // pictures of the day 610 } else if (/^\/slideshow\/[0-9][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9]\/nytfrontpage\//.test(wt_path)) {611 contentGroup = "Homepage";612 613 // selfservice614 } else if (wt_domain == "nytimes.adready.com") {615 contentGroup = "Self Service";616 // default to General 617 } else {618 contentGroup = "General";619 }620 }621 return contentGroup;622}623function readPageTags() {624 addMetaTag("WT.z_gpt", getMetaTag("PT")); // page type625 addMetaTag("WT.z_gpst", getMetaTag("PST")); // page subtype626 addMetaTag("WT.z_gpsst", getMetaTag("PSST")); // page sub 2 type627 addMetaTag("WT.z_gpssst", getMetaTag("PSSST")); // page sub 3 type628 addMetaTag("WT.z_pc", getMetaTag("PC")); // partner content629 addMetaTag("WT.z_ps", getMetaTag("PS")); // partner supplied 630 addMetaTag("WT.z_puv", getMetaTag("PUV")); // publish view631 addMetaTag("WT.z_gosst", getMetaTag("GOOST")); // global onsite search632 addMetaTag("WT.z_gosst", getMetaTag("GOSST")); // global onsite search633 addMetaTag("WT.z_gsac", getMetaTag("GSAC")); // global search auto complete634 addMetaTag("WT.z_gtn", getMetaTag("GTN")); // global topic name635 addMetaTag("WT.gcom", getMetaTag("GCOM")); // global - community page636 addMetaTag("WT.z_clmst", getMetaTag("CLMST")); // blogs off About637 addMetaTag("WT.z_bn", getMetaTag("BN")); // blogs off About638 addMetaTag("WT.z_pud", getMetaTag("PUD")); // blogs off About639 addMetaTag("WT.z_tvt", getMetaTag("TVT")); // travel meta tag640 addMetaTag("WT.z_tvn", getMetaTag("TVN")); // travel meta tag641 addMetaTag("WT.z_tvid", getMetaTag("TVID")); // travel meta tag642 addMetaTag("WT.z_tDest", getMetaTag("TDES")); // travel meta tag643 addMetaTag("WT.z_tRegion",getMetaTag("TDREG")); // travel meta tag644 addMetaTag("WT.cre", getMetaTag("cre")); // creator meta tag645 addMetaTag("WT.z_nyts", getCookie("NYT-S")); // NYT-S cookie 646 addMetaTag("WT.z_nytd", getCookie("nyt-d")); // nyt-d cookie 647 addMetaTag("WT.z_rmid", getCookie("RMID")); // RMID cookie 648 addMetaTag("WT.z_gblc", getMetaTag("GBLC")); // global - blogs 649 addMetaTag("WT.z_hpt", getMetaTag("HPT")); // home page type - Extra650}651function getCookie ( cookie_name )652{653 var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );654 if ( results )655 return ( unescape ( results[2] ) );656 else657 return null;658}659function setContentInfo() {660 // read page tags for content groups661 if (wt_contentGroup == "Health") {662 663 addMetaTag("WT.z_hgst", getMetaTag("HGST")); // health guide subject type664 addMetaTag("WT.z_hgsn", getMetaTag("HGSN")); // health guide subject name665 includeFile(js_host+"googleAnalytics/initialize.js");666 } else if (wt_contentGroup == "Times Topics") {667 addMetaTag("WT.z_gpt", "Topic");668 } else if (wt_contentGroup == "Books") {669 addMetaTag("WT.z_bper", getMetaTag("per"));670 addMetaTag("WT.z_ebk", getMetaTag("ttl"));671 } else if (wt_contentGroup == "Real Estate" || wt_contentGroup == "Great Homes") {672 addMetaTag("WT.z_resz", getMetaTag("RESZ")); // real estate search zip codes673 addMetaTag("WT.z_res", getMetaTag("RES")); // real estate state674 addMetaTag("WT.z_reco", getMetaTag("RECO")); // real estate counties675 addMetaTag("WT.z_rer", getMetaTag("RER")); // real estate region 676 } else if (wt_contentGroup == "Theater") {677 addMetaTag("WT.z_eplay", getMetaTag("ttl"));678 } else if (wt_contentGroup == "Travel") {679 includeFile(js_host+"content/travel_v1.1.js");680 includeFile(js_host+"googleAnalytics/initialize.js");681 } else if (wt_contentGroup == "Movies") {682 includeFile(js_host+"content/movies_v1.1.js");683 } else if (wt_contentGroup == "Email This") {684 includeFile(js_host+"content/emailthis_v1.1.js");685 } else if (wt_contentGroup == "Business") {686 includeFile(js_host+"googleAnalytics/initialize.js");687 }688}689function setReferrerInfo() {690 //check for frameset referrer cookie691 var origRefUrl = getCookie("FramesetReferrer");692 var refUrl = origRefUrl || document.referrer;693 if (refUrl != undefined && refUrl != "" ) {694 var refDom = refUrl.match( /:\/\/(www\.)?([^\/:]+)/ ); 695 refDom = refDom[2]?refDom[2]:''; 696 addMetaTag("WT.z_ref", refDom);697 addMetaTag("WT.z_sorg", isSearchEngine(refDom)); 698 }699}700function getReferrerQuery() {701 var refQuery = "";702 var url_parts = document.referrer.split('?');703 if (url_parts[1]){ 704 var url_args = url_parts[1].split('&');705 for(var i=0; i<url_args.length; i++){706 var keyval = url_args[i].split('=');707 if (keyval[0] == 'q'){708 refQuery = keyval[1];709 }710 }711 }712 return refQuery;713}714function isSearchEngine(refDom) {715 var refType = "";716 if((/google\./.test(refDom) && getReferrerQuery() != "") 717 ||(/search\./.test(refDom))718 ||(/ask.com/.test(refDom))719 ||(/altavista.com/.test(refDom))) {720 refType = "1";721 }722 return refType;723}724function handleCGExceptions() {725 // promote to content group726 if (wt_subcontentGroup == "dance") {727 wt_contentGroup = "Dance";728 wt_subcontentGroup = "";729 } else if (wt_subcontentGroup == "music") {730 wt_contentGroup = "Music";731 wt_subcontentGroup = "";732 } else if (wt_subcontentGroup == "television") {733 wt_contentGroup = "TV";734 wt_subcontentGroup = "";735 } else if (wt_subcontentGroup == "olympics") {736 wt_contentGroup = "Olympics";737 wt_subcontentGroup = "";738 } else if (wt_subcontentGroup == "politics") {739 wt_contentGroup = "Politics";740 wt_subcontentGroup = "";741 }742 // demote to subcontent group743 if (wt_cgTag == "education") {744 wt_subcontentGroup = "Education";745 } else if (wt_cgTag == "washington") {746 wt_subcontentGroup = "Washington";747 } else if (wt_cgTag == "fashion") {748 wt_subcontentGroup = "Fashion";749 } else if (wt_cgTag == "dining") {750 wt_subcontentGroup = "Dining";751 } else if (wt_cgTag == "garden") {752 wt_subcontentGroup = "Garden";753 } else if ((wt_cgTag == "Your Money") || (wt_cgTag == "your-money")) {754 if(getMetaTag("PT") == "Article") { addMetaTag("WT.z_gtn", wt_subcontentGroup); }755 wt_contentGroup = "Business";756 wt_subcontentGroup = "Your Money";757 }758 // rewrite content group based on subcontentgroup759 if (wt_scgTag == "Weddings") {760 wt_contentGroup = "Style";761 wt_subcontentGroup = "Weddings";762 }763 if (wt_subcontentGroup == "Dealbook Jobs") {764 wt_contentGroup = "Business";765 }766 767 // rewrite content group768 if (wt_cgTag == "xword") {769 wt_contentGroup = "Crosswords/Games";770 }771}772function setSectionFront() {773 if ( (getMetaTag("WT.z_gpt") == "Section Front") && getMetaTag("WT.cg_s")) {774 tempWTVal = "Subsection Front";775 addMetaTag("WT.z_gpst", "Subsection Front");776 }777}778function setInteractiveGraphicInfo() {779 addMetaTag("WT.z_gpt", "Multimedia");780 addMetaTag("WT.z_gpst", "Flash");781 addMetaTag("WT.z_pud", getMetaTag("pdate"));782}783function setSlideshowInfo() {784 addMetaTag("WT.z_gpt", "Multimedia");785 addMetaTag("WT.z_gpst", "Slideshow");786 addMetaTag("WT.z_pud", getMetaTag("pdate"));787 addMetaTag("WT.z_sssn", getMetaTag("SSSN"));788 addMetaTag("WT.z_ssts", getMetaTag("SSTS"));789 addMetaTag("WT.z_sse", getMetaTag("SSE"));790}791function setSundayReviewInfo() {792 overwriteMetaTag("WT.cg_n", "Opinion");793 overwriteMetaTag("WT.cg_s", "Sunday Review");794}795function setArticleInfo(articleID) {796 if (articleID != "") {797 var pubDate = getMetaTag("pdate");798 var pubType = getPubTypeFromDate(pubDate); 799 addMetaTag("WT.z_gpt", "Article");800 addMetaTag("WT.z_gpst", getMetaTag("tom"));801 addMetaTag("WT.z_hdl", getMetaTag("hdl")); 802 if (pubType == "Archive") {803 addMetaTag("WT.z_aid", 'nyta-' + articleID);804 } else {805 addMetaTag("WT.z_aid", articleID);806 }807 addMetaTag("WT.z_pud", pubDate);808 addMetaTag("WT.z_put", pubType);809 addMetaTag("WT.z.gsg", pubType);810 811 if (pubDate.length==8) {812 var tYear = pubDate.substring(0,4);813 if (tYear < 2004) {814 addMetaTag("WT.ti", "Archive Article from " + tYear);815 addMetaTag("DCS.dcsuri", "http://www.nytimes.com/archive/"+tYear+".html");816 } 817 if (pubType == "Archive") {818 if (tYear >=1987) {819 addMetaTag("WT.z_gat", "1987-Present");820 }821 else if (tYear >=1981) {822 addMetaTag("WT.z_gat", "1981-1986");823 }824 else if (tYear >=1923) {825 addMetaTag("WT.z_gat", "1923-1980");826 }827 else {828 addMetaTag("WT.z_gat", "1851-1922");829 }830 } 831 }832 833 addMetaTag("WT.z_pua", "free");834 var bylVal = getMetaTag("byl");835 bylVal = bylVal.replace("&#8217;","'"); 836 if (bylVal.indexOf("By ") != -1) {837 bylVal = bylVal.substring(3);838 bylValInd = bylVal.indexOf(" and ");839 if (bylValInd != -1) {840 bylVal = bylVal.substring(0, bylValInd) + ";" + bylVal.substring(bylValInd+5);841 }842 }843 addMetaTag("WT.z_clmst", bylVal);844 setXTS(bylVal);845 var pageWanted = getQueryParameter("pagewanted");846 if (pageWanted == "") {847 addMetaTag("WT.z_puv", "Normal"); 848 } else {849 addMetaTag("WT.z_puv", pageWanted);850 }851 }852}853function setPubDateInfo(pdate) {854 setPubDateRange(pdate);855 addMetaTag("WT.z_pyr", pdate.substring(0, 4));856}857function setPubDateRange(pdate) {858 var relativePubDate = "No Pub Date";859 var currentDate = new Date();860 var currentDateMs = currentDate.getTime();861 var pubDate = new Date();862 if (pdate.length==8) {863 var tYear = pdate.substring(0,4);864 var tMonth = pdate.substring(4,6);865 var tDay = pdate.substring(6,8);866 pubDate.setFullYear(tYear,tMonth-1,tDay);867 }868 var pubDateMs = pubDate.getTime();869 var publicDomainStartDate = new Date();870 publicDomainStartDate.setYear(1851);871 publicDomainStartDate.setMonth(0);872 publicDomainStartDate.setDate(1);873 var publicDomainStartDateMs = publicDomainStartDate.getTime();874 var payArchiveStartDate = new Date();875 payArchiveStartDate.setYear(1923);876 payArchiveStartDate.setMonth(0);877 payArchiveStartDate.setDate(1);878 var payArchiveStartDateMs = payArchiveStartDate.getTime();879 var payArchiveEndDate = new Date();880 payArchiveEndDate.setYear(1986);881 payArchiveEndDate.setMonth(11);882 payArchiveEndDate.setDate(31);883 var payArchiveEndDateMs = payArchiveEndDate.getTime();884 var dateDiffMs = currentDateMs - pubDateMs;885 if(dateDiffMs < 0) {886 relativePubDate = "Tomorrow";887 } else if(0 <= dateDiffMs && dateDiffMs < 86400000) {888 relativePubDate = "Same Day";889 } else if(86400000 <= dateDiffMs && dateDiffMs < 172800000) {890 relativePubDate = "1 Day";891 } else if(172800000 <= dateDiffMs && dateDiffMs < 259200000) {892 relativePubDate = "2 Day";893 } else if(259200000 <= dateDiffMs && dateDiffMs < 345600000) {894 relativePubDate = "3 Day";895 } else if(345600000 <= dateDiffMs && dateDiffMs < 432000000) {896 relativePubDate = "4 Day";897 } else if(432000000 <= dateDiffMs && dateDiffMs < 518400000) {898 relativePubDate = "5 Day";899 } else if(518400000 <= dateDiffMs && dateDiffMs < 604800000) {900 relativePubDate = "6 Day";901 } else if(604800000 <= dateDiffMs && dateDiffMs < 691200000) {902 relativePubDate = "7 Day";903 } else if(691200000 <= dateDiffMs && dateDiffMs < 2678400000) {904 relativePubDate = "Month";905 } else if(2678400000 <= dateDiffMs && dateDiffMs < 7776000000) {906 relativePubDate = "90 Day";907 } else if(7776000000 <= dateDiffMs && dateDiffMs < 31536000000) {908 relativePubDate = "1 Year";909 } else if(31536000000 <= dateDiffMs && dateDiffMs < 157680000000) {910 relativePubDate = "5 Years";911 } else if(157680000000 <= dateDiffMs && dateDiffMs < 315360000000) {912 relativePubDate = "10 Years";913 } else if(315360000000 <= dateDiffMs && pubDateMs > payArchiveEndDateMs) {914 relativePubDate = "Post 86";915 } else if(315360000000 <= dateDiffMs && (payArchiveStartDateMs <= pubDateMs && pubDateMs <= payArchiveEndDateMs)) {916 relativePubDate = "Pay Archive";917 } else if(315360000000 <= dateDiffMs && (publicDomainStartDateMs <= pubDateMs && pubDateMs <= payArchiveStartDateMs)) {918 relativePubDate = "Public Domain";919 }920 addMetaTag("WT.z_pudr", relativePubDate);921}922function setCommentOverflowInfo(articleID) {923 addMetaTag("WT.z_aid", articleID);924 addMetaTag("WT.z_hdl", getMetaTag("hdl")); 925 if (getMetaTag("WT.z_gpst") == "Comments Overflow") {926 addMetaTag("WT.gcom", "Com"); 927 }928 929 // Set article comment page number 930 addMetaTag("WT.z_acpn", getMetaTag("ACPN"));931 // Set article comment overview sort932 addMetaTag("WT.z_acos", getMetaTag("ACOS"));933}934function getPubTypeFromDate(pdate) {935 if (pdate != undefined && pdate.length == 8) {936 var currentDate = new Date();937 var articleDate = new Date();938 articleDate.setDate(pdate.substring(6));939 articleDate.setMonth(pdate.substring(4,6)-1);940 articleDate.setFullYear(pdate.substring(0,4));941 if (articleDate < currentDate) {942 return "Archive";943 } else {944 return "web";945 }946 } else {947 return "web";948 }949}950function setXTS(clmst) {951 if (/DAVID BROOKS/.test(clmst)952 ||/MAUREEN DOWD/.test(clmst)953 ||/ROGER COHEN/.test(clmst)954 ||/THOMAS L. FRIEDMAN/.test(clmst)955 ||/BOB HERBERT/.test(clmst)956 ||/NICHOLAS D. KRISTOF/.test(clmst)957 ||/PAUL KRUGMAN/.test(clmst)958 ||/FRANK RICH/.test(clmst)959 ||/DAVE ANDERSON/.test(clmst)960 ||/PETER APPLEBOME/.test(clmst)961 ||/HARVEY ARATON/.test(clmst)962 ||/DAN BARRY/.test(clmst)963 ||/JIM DWYER/.test(clmst)964 ||/CLYDE HABERMAN/.test(clmst)965 ||/ADAM LIPTAK/.test(clmst)966 ||/GRETCHEN MORGENSON/.test(clmst)967 ||/JOE NOCERA/.test(clmst)968 ||/JOSEPH NOCERA/.test(clmst)969 ||/FLOYD NORRIS/.test(clmst)970 ||/WILLIAM C. RHODEN/.test(clmst)971 ||/SELENA ROBERTS/.test(clmst)972 ||/GEORGE VECSEY/.test(clmst)973 ||/JOHN VINOCUR/.test(clmst)) {974 addMetaTag("WT.z_gts", "XTS");975 }976}977function setSearchInfo() {978 var searchResults;979 var wt_oss = "";980 var wt_oss_r = "";981 var wt_gosst = "";982 var ossName = "";983 var ossrName = "";984 // for global searches985 if (/^\/search\/query/.test(nyt_path)) {986 wt_oss = getQueryParameter("query");987 searchResults = document.getElementById("sortBy");988 wt_gosst = getQueryParameter("srchst");989 ossName = "WT.oss";990 ossrName = "WT.oss_r";991 }992 // for tech search only993 if (/\/gst\/technology\/techsearch.html/.test(nyt_path)) {994 wt_oss = getQueryParameter("query");995 searchResults = getElementsByClass("div", "result_summary");996 ossName = "WT.z_toss";997 ossrName = "WT.z_toss_r";998 }999 // for movie search only1000 if (/\/gst\/movies\/msearch.html/.test(nyt_path)) {1001 wt_oss = getQueryParameter("query");1002 searchResults = document.getElementById("resultsWell");1003 ossName = "WT.z_moss";1004 ossrName = "WT.z_moss_r";1005 }1006 // for health search only1007 if (/\/gst\/health\/healthsearch.html/.test(nyt_path)) {1008 wt_oss = getQueryParameter("query");1009 if (wt_oss == "") {1010 wt_oss = getQueryParameter("term"); 1011 }1012 searchResults = document.getElementById("sortBy");1013 ossName = "WT.z_hoss";1014 ossrName = "WT.z_hoss_r";1015 }1016 if (null == searchResults) {1017 wt_oss_r = "0";1018 } else {1019 wt_oss_r = "1";1020 if (wt_oss == "" ) {1021 wt_oss = "No Term";1022 }1023 }1024 if (wt_oss != "") {1025 addMetaTag(ossName, wt_oss);1026 addMetaTag(ossrName, wt_oss_r);1027 }1028 if (wt_gosst != "") {1029 var wt_osstArray = {"nyt":"Search > Articles 1981-Present",1030 "p":"Search > Articles 1851-1980",1031 "g":"Search > Google Web Results",1032 "m":"Search > Multimedia",1033 "nycks":"Search > NYC Events & Venues",1034 "ref":"Search > Reference",1035 "blog":"Search > Blogs"}1036 var searchType = wt_osstArray[wt_gosst];1037 if (searchType == undefined) {1038 searchType = wt_gosst;1039 }1040 addMetaTag("WT.z_gosst", searchType);1041 }1042}1043function setTrackEvents() {1044 var wt_section = getMetaTag("WT.cg_n");1045 var wt_subsection = getMetaTag("WT.cg_s");1046 var wt_pagetype = getMetaTag("WT.z_gpt");1047 var wt_pagesubtype = getMetaTag("WT.z_gpst");1048 if ((wt_pagetype == "Homepage" && wt_pagesubtype != "Times Extra") ||1049 (wt_section == "Politics" && wt_pagetype == "Section Front") ||1050 (wt_section == "Opinion" && wt_pagetype == "Section Front") ||1051 (wt_section == "Business" && wt_pagetype == "Section Front") ||1052 (wt_subsection == "Dealbook" && wt_pagesubtype == "Blog Main")) {1053 gtrackevents = true;1054 }1055}1056// helper functions used by this and other content javascript files1057function addMetaTag(tagName, tagContent) {1058 var tempValue = getMetaTag(tagName);1059 if (tempValue == "") {1060 tempValue = getQueryParameter(tagName);1061 }1062 if (tempValue == "" && tagContent != "") {1063 var newMetaTag = document.createElement('meta');1064 newMetaTag.id = tagName;1065 newMetaTag.name = tagName;1066 newMetaTag.content = tagContent;1067 document.getElementsByTagName('head').item(0).appendChild(newMetaTag);1068 }1069}1070function overwriteMetaTag(tagName, tagContent) {1071 var newMetaTag = document.createElement('meta');1072 newMetaTag.id = tagName;1073 newMetaTag.name = tagName;1074 newMetaTag.content = tagContent;1075 document.getElementsByTagName('head').item(0).appendChild(newMetaTag);1076}1077function getMetaTag(tagName) {1078 var metaTagContent = "";1079 var metaTagElement = document.getElementById(tagName);1080 var tempString = "";1081 if (metaTagElement == null || metaTagElement == undefined) {1082 var metaTags = document.getElementsByTagName("meta");1083 for(var i=0;i<metaTags.length;i++) {1084 if(metaTags[i].name == tagName) {1085 metaTagContent = metaTags[i].content;1086 }1087 }1088 } else {1089 metaTagContent = metaTagElement.content;1090 }1091 return metaTagContent;1092}1093function getQueryParameter(name) {1094 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");1095 var regexS = "[\\?&]"+name+"=([^&#]*)";1096 var regex = new RegExp( regexS );1097 var results = regex.exec( window.location.href );1098 if( results == null ) {1099 return "";1100 } else {1101 return results[1];1102 }1103}1104function queryParameterExists(name) {1105 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");1106 var regexS = "[\\?&]"+name;1107 var regex = new RegExp( regexS );1108 return regex.test( window.location.href );1109}1110function setDefaultTags() {1111 if (getMetaTag("WT.z_gpt") == "") {1112 addMetaTag("WT.z_gpt", "Other");1113 }1114}1115function getElementsByClass(tagName, className) {1116 var resultArray = new Array();1117 var classRegExp = new RegExp('\\b'+className+'\\b');1118 var elementsByTag = document.getElementsByTagName(tagName);1119 for(var i=0,j=elementsByTag.length; i<j; i++) {1120 if(classRegExp.test(elementsByTag[i].className)) {1121 resultArray.push(elementsByTag[i]);1122 } 1123 }1124 if (resultArray.length == 0) resultArray = null;1125 return resultArray;1126}1127function includeFile(incFilename) {1128 var incFileJS = document.createElement('script');1129 incFileJS.setAttribute('language', 'javascriptcontent');1130 incFileJS.setAttribute('type', 'text/javascript');1131 incFileJS.setAttribute('src', incFilename);1132 document.getElementsByTagName('head').item(0).appendChild(incFileJS);1133}1134s_code_linktrack = s_code_linktrack_classifieds = s_code_linktrack_indiv = function(desc) {1135 try { dcsMultiTrack('DCS.dcssip', 'www.nytimes.com', 'DCS.dcsuri', '/' + desc + '.html', 'WT.ti', desc, 'WT.z_dcsm', '1'); }1136 catch(err) { }1137};1138(function () {1139 // anything that should occur after initial dcs.gif is completed should go in this function1140 function onAfterDcsGif() {1141 // don't want hp refresh tracking in later DCS tracking1142 if (typeof WT != "undefined" && WT.z_jog) {1143 delete WT.z_jog;1144 }1145 // clean up meta just in case WT scrapes them again1146 var jogMetaTags = document.getElementsByName('WT.z_jog');1147 if (jogMetaTags.length > 0) {1148 var toRemove = jogMetaTags[0];1149 toRemove.parentNode.removeChild(toRemove);1150 }1151 }1152 function pollForDCS(count) {1153 var MAX_CHECKS = 20;1154 // see if the dcs object exists in the dom and if it has an image list set up1155 if (typeof dcsInit === "undefined" || !dcsInit.images) {1156 if (count < MAX_CHECKS) {1157 setTimeout(function() { pollForDCS(count+1) }, 100);1158 }1159 else {1160 return;1161 }1162 }1163 // dcsInit.images exists, is our dcs.gif in there?1164 else {1165 var found = false;1166 for (var i = 0, len = dcsInit.images.length; i < len; ++i) {1167 var cur = dcsInit.images[i];1168 if (cur.src && cur.src.match('dcs.gif')) {1169 onAfterDcsGif();1170 found = true;1171 break;1172 }1173 }1174 if (!found) {1175 if (count < MAX_CHECKS) {1176 setTimeout(function() { pollForDCS(count+1) }, 100);1177 }1178 else {1179 return;1180 }1181 }1182 }1183 }1184 pollForDCS(1);...

Full Screen

Full Screen

webtrends.js

Source:webtrends.js Github

copy

Full Screen

1// WebTrends SmartSource Data Collector Tag2// Version: 9.4.0 3// Tag Builder Version: 4.14// Created: 5/31/2013 5:49:11 PM56function WebTrends(){7 var that=this;8 // begin: user modifiable9 this.dcsid="dcsa7yzrmbdzpxzrosrn4tyep_5i1d";10 this.domain="logs1.smithsonian.museum";11 this.timezone=-5;12 this.enabled=true;13 this.i18n=false;14 this.paidsearchparams="gclid";15 this.splitvalue="";16 this.preserve=false;17 this.cookieTypes = "all";18 this.FPCConfig = {19 enabled: (this.cookieTypes === "all" || this.cookieTypes == "firstPartyOnly"),20 name: "WT_FPC",21 domain: ".minorplanetcenter.net",22 expires: 6311385150023 };24 this.TPCConfig = {25 enabled: (this.cookieTypes === "all"),26 cfgType: (this.cookieTypes === "all") ? "":"1"27 };28 // end: user modifiable29 this.DCS={};30 this.WT={};31 this.DCSext={};32 this.images=[];33 this.index=0;3435 this.exre=(function(){return(window.RegExp?new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)","i"):"");})();36 this.re=(function(){return(window.RegExp?(that.i18n?{"%25":/\%/g,"%26":/\&/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}):"");})();37}38WebTrends.prototype.dcsGetId=function(){39 if (this.enabled&&(document.cookie.indexOf(this.FPCConfig.name+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)&&this.TPCConfig.enabled){40 document.write("<scr"+"ipt type='text/javascript' src='"+"http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+"/"+this.dcsid+"/wtid.js"+"'><\/scr"+"ipt>");41 }42}43WebTrends.prototype.setCookieTypes = function (types) {44 this.FPCConfig.enabled = (types === "all" || types == "firstPartyOnly"); 45 this.TPCConfig.enabled = (types === "all");46 this.TPCConfig.cfgType = (types === "all") ? "":"1"47}48WebTrends.prototype.dcsGetCookie=function(name){49 var cookies=document.cookie.split("; ");50 var cmatch=[];51 var idx=0;52 var i=0;53 var namelen=name.length;54 var clen=cookies.length;55 for (i=0;i<clen;i++){56 var c=cookies[i];57 if ((c.substring(0,namelen+1))==(name+"=")){58 cmatch[idx++]=c;59 }60 }61 var cmatchCount=cmatch.length;62 if (cmatchCount>0){63 idx=0;64 if ((cmatchCount>1)&&(name==this.FPCConfig.name)){65 var dLatest=new Date(0);66 for (i=0;i<cmatchCount;i++){67 var lv=parseInt(this.dcsGetCrumb(cmatch[i],"lv"));68 var dLst=new Date(lv);69 if (dLst>dLatest){70 dLatest.setTime(dLst.getTime());71 idx=i;72 }73 }74 }75 return unescape(cmatch[idx].substring(namelen+1));76 }77 else{78 return null;79 }80}81WebTrends.prototype.dcsGetCrumb=function(cval,crumb,sep){82 var aCookie=cval.split(sep||":");83 for (var i=0;i<aCookie.length;i++){84 var aCrumb=aCookie[i].split("=");85 if (crumb==aCrumb[0]){86 return aCrumb[1];87 }88 }89 return null;90}91WebTrends.prototype.dcsGetIdCrumb=function(cval,crumb){92 var id=cval.substring(0,cval.indexOf(":lv="));93 var aCrumb=id.split("=");94 for (var i=0;i<aCrumb.length;i++){95 if (crumb==aCrumb[0]){96 return aCrumb[1];97 }98 }99 return null;100}101WebTrends.prototype.dcsIsFpcSet=function(name,id,lv,ss){102 var c=this.dcsGetCookie(name);103 if (c){104 return ((id==this.dcsGetIdCrumb(c,"id"))&&(lv==this.dcsGetCrumb(c,"lv"))&&(ss==this.dcsGetCrumb(c,"ss")))?0:3;105 }106 return 2;107}108WebTrends.prototype.dcsDeleteCookie=function(name, path, domain) { 109 var cDelete = name + "=";110 cDelete += "; expires=expires=Thu, 01 Jan 1970 00:00:01 GMT";111 cDelete += "; path=" + path;112 cDelete += (domain) ? ";domain="+domain : ""; 113 document.cookie = cDelete;114}115WebTrends.prototype.dcsFPC=function(){116 if (document.cookie.indexOf("WTLOPTOUT=")!=-1){117 return;118 }119120 if (!this.FPCConfig.enabled && !this.TPCConfig.enabled)121 this.WT["ce"] = "0"122 else if (this.FPCConfig.enabled && !this.TPCConfig.enabled)123 this.WT["ce"] = "1";124 else125 this.WT["ce"] = "2";126127 if (!this.FPCConfig.enabled) {128 this.dcsDeleteCookie(this.FPCConfig.name, "/", this.FPCConfig.domain);129 return;130 }131132 var WT=this.WT;133 var name=this.FPCConfig.name;134 var dCur=new Date();135 var adj=(dCur.getTimezoneOffset()*60000)+(this.timezone*3600000);136 dCur.setTime(dCur.getTime()+adj);137 var dExp=new Date(dCur.getTime()+315360000000);138 var dSes=new Date(dCur.getTime());139 WT.co_f=WT.vtid=WT.vtvs=WT.vt_f=WT.vt_f_a=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";140 if (document.cookie.indexOf(name+"=")==-1){141 if ((typeof(gWtId)!="undefined")&&(gWtId!="")){142 WT.co_f=gWtId;143 }144 else if ((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){145 WT.co_f=gTempWtId;146 WT.vt_f="1";147 }148 else{149 WT.co_f="2";150 var curt=dCur.getTime().toString();151 for (var i=2;i<=(32-curt.length);i++){152 WT.co_f+=Math.floor(Math.random()*16.0).toString(16);153 }154 WT.co_f+=curt;155 WT.vt_f="1";156 }157 if (typeof(gWtAccountRollup)=="undefined"){158 WT.vt_f_a="1";159 }160 WT.vt_f_s=WT.vt_f_d="1";161 WT.vt_f_tlh=WT.vt_f_tlv="0";162 }163 else{164 var c=this.dcsGetCookie(name);165 var id=this.dcsGetIdCrumb(c,"id");166 var lv=parseInt(this.dcsGetCrumb(c,"lv"));167 var ss=parseInt(this.dcsGetCrumb(c,"ss"));168 if ((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){169 return;170 }171 WT.co_f=id;172 var dLst=new Date(lv);173 WT.vt_f_tlh=Math.floor((dLst.getTime()-adj)/1000);174 dSes.setTime(ss);175 if ((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){176 WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000);177 dSes.setTime(dCur.getTime());178 WT.vt_f_s="1";179 }180 if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){181 WT.vt_f_d="1";182 }183 }184 WT.co_f=escape(WT.co_f);185 WT.vtid=(typeof(this.vtid)=="undefined")?WT.co_f:(this.vtid||"");186 WT.vtvs=(dSes.getTime()-adj).toString();187 var expiry= (this.FPCConfig.expires) ? "; expires="+ new Date(new Date().getTime() + (this.FPCConfig.expires)).toGMTString():"";188 var cur=dCur.getTime().toString();189 var ses=dSes.getTime().toString();190 document.cookie=name+"="+"id="+WT.co_f+":lv="+cur+":ss="+ses+expiry+"; path=/"+(((this.FPCConfig.domain!=""))?("; domain="+this.FPCConfig.domain):(""));191 var rc=this.dcsIsFpcSet(name,WT.co_f,cur,ses);192 if (rc!=0){193 WT.co_f=WT.vtvs=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";194 if (typeof(this.vtid)=="undefined"){195 WT.vtid="";196 }197 WT.vt_f=WT.vt_f_a=rc;198 }199}200WebTrends.prototype.dcsMultiTrack=function(){201 var args=dcsMultiTrack.arguments?dcsMultiTrack.arguments:arguments;202 if (args.length%2==0){203 this.dcsSaveProps(args);204 this.dcsSetProps(args);205 var dCurrent=new Date();206 this.DCS.dcsdat=dCurrent.getTime();207 this.dcsFPC();208 this.dcsTag();209 this.dcsRestoreProps();210 }211}212213WebTrends.prototype.dcsCleanUp=function(){214 this.DCS={};215 this.WT={};216 this.DCSext={};217 if (arguments.length%2==0){218 this.dcsSetProps(arguments);219 }220}221WebTrends.prototype.dcsSetProps=function(args){222 for (var i=0;i<args.length;i+=2){223 if (args[i].indexOf('WT.')==0){224 this.WT[args[i].substring(3)]=args[i+1];225 }226 else if (args[i].indexOf('DCS.')==0){227 this.DCS[args[i].substring(4)]=args[i+1];228 }229 else if (args[i].indexOf('DCSext.')==0){230 this.DCSext[args[i].substring(7)]=args[i+1];231 }232 }233}234WebTrends.prototype.dcsSaveProps=function(args){235 var i,x,key,param;236 if (this.preserve){237 this.args=[];238 for (i=0,x=0;i<args.length;i+=2){239 param=args[i];240 if (param.indexOf('WT.')==0){241 key=param.substring(3);242 this.args[x]=param;243 this.args[x+1]=this.WT[key]||"";244 x+=2;245 }246 else if (param.indexOf('DCS.')==0){247 key=param.substring(4);248 this.args[x]=param;249 this.args[x+1]=this.DCS[key]||"";250 x+=2;251 }252 else if (param.indexOf('DCSext.')==0){253 key=param.substring(7);254 this.args[x]=param;255 this.args[x+1]=this.DCSext[key]||"";256 x+=2;257 }258 }259 }260}261WebTrends.prototype.dcsRestoreProps=function(){262 if (this.preserve){263 this.dcsSetProps(this.args);264 this.args=[];265 }266}267WebTrends.prototype.dcsAdv=function(){268 this.dcsFPC();269}270WebTrends.prototype.dcsVar=function(){271 var dCurrent=new Date();272 var WT=this.WT;273 var DCS=this.DCS;274 WT.tz=parseInt(dCurrent.getTimezoneOffset()/60*-1)||"0";275 WT.bh=dCurrent.getHours()||"0";276 WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;277 if (typeof(screen)=="object"){278 WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;279 WT.sr=screen.width+"x"+screen.height;280 }281 if (typeof(navigator.javaEnabled())=="boolean"){282 WT.jo=navigator.javaEnabled()?"Yes":"No";283 }284 if (document.title){285 if (window.RegExp){286 var tire=new RegExp("^"+window.location.protocol+"//"+window.location.hostname+"\\s-\\s");287 WT.ti=document.title.replace(tire,"");288 }289 else{290 WT.ti=document.title;291 }292 }293 WT.js="Yes";294 WT.jv=(function(){295 var agt=navigator.userAgent.toLowerCase();296 var major=parseInt(navigator.appVersion);297 var mac=(agt.indexOf("mac")!=-1);298 var ff=(agt.indexOf("firefox")!=-1);299 var ff0=(agt.indexOf("firefox/0.")!=-1);300 var ff10=(agt.indexOf("firefox/1.0")!=-1);301 var ff15=(agt.indexOf("firefox/1.5")!=-1);302 var ff20=(agt.indexOf("firefox/2.0")!=-1);303 var ff3up=(ff&&!ff0&&!ff10&!ff15&!ff20);304 var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1));305 var nn4=(nn&&(major==4));306 var nn6up=(nn&&(major>=5));307 var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));308 var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1));309 var ie5up=(ie&&!ie4);310 var op=(agt.indexOf("opera")!=-1);311 var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);312 var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1);313 var op7up=(op&&!op5&&!op6);314 var jv="1.1";315 if (ff3up){316 jv="1.8";317 }318 else if (ff20){319 jv="1.7";320 }321 else if (ff15){322 jv="1.6";323 }324 else if (ff0||ff10||nn6up||op7up){325 jv="1.5";326 }327 else if ((mac&&ie5up)||op6){328 jv="1.4";329 }330 else if (ie5up||nn4||op5){331 jv="1.3";332 }333 else if (ie4){334 jv="1.2";335 }336 return jv;337 })();338 WT.ct="unknown";339 if (document.body&&document.body.addBehavior){340 try{341 document.body.addBehavior("#default#clientCaps");342 WT.ct=document.body.connectionType||"unknown";343 document.body.addBehavior("#default#homePage");344 WT.hp=document.body.isHomePage(location.href)?"1":"0";345 }346 catch(e){347 }348 }349 if (document.all){350 WT.bs=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"unknown";351 }352 else{353 WT.bs=window.innerWidth+"x"+window.innerHeight;354 }355 WT.fv=(function(){356 var i,flash;357 if (window.ActiveXObject){358 for(i=15;i>0;i--){359 try{360 flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);361 return i+".0";362 }363 catch(e){364 }365 }366 }367 else if (navigator.plugins&&navigator.plugins.length){368 for (i=0;i<navigator.plugins.length;i++){369 if (navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){370 return navigator.plugins[i].description.split(" ")[2];371 }372 }373 }374 return "Not enabled";375 })();376 WT.slv=(function(){377 var slv="Not enabled";378 try{ 379 if (navigator.userAgent.indexOf('MSIE')!=-1){380 var sli = new ActiveXObject('AgControl.AgControl');381 if (sli){382 slv="Unknown";383 }384 }385 else if (navigator.plugins["Silverlight Plug-In"]){386 slv="Unknown";387 }388 }389 catch(e){390 }391 if (slv!="Not enabled"){392 var i,m,M,F;393 if ((typeof(Silverlight)=="object")&&(typeof(Silverlight.isInstalled)=="function")){394 for(i=9;i>0;i--){395 M=i;396 if (Silverlight.isInstalled(M+".0")){397 break;398 }399 if (slv==M){400 break;401 }402 }403 for (m=9;m>=0;m--){404 F=M+"."+m;405 if (Silverlight.isInstalled(F)){406 slv=F;407 break;408 }409 if (slv==F){410 break;411 }412 }413 }414 }415 return slv;416 })();417 if (this.i18n){418 if (typeof(document.defaultCharset)=="string"){419 WT.le=document.defaultCharset;420 } 421 else if (typeof(document.characterSet)=="string"){422 WT.le=document.characterSet;423 }424 else{425 WT.le="unknown";426 }427 }428 WT.tv="9.4.0";429 WT.sp=this.splitvalue;430 WT.dl="0";431 WT.ssl=(window.location.protocol.indexOf('https:')==0)?"1":"0";432 DCS.dcsdat=dCurrent.getTime();433 DCS.dcssip=window.location.hostname;434 DCS.dcsuri=window.location.pathname;435 WT.es=DCS.dcssip+DCS.dcsuri;436 if (window.location.search){437 DCS.dcsqry=window.location.search;438 }439 if (DCS.dcsqry){440 var dcsqry=DCS.dcsqry.toLowerCase();441 var params=this.paidsearchparams.length?this.paidsearchparams.toLowerCase().split(","):[];442 for (var i=0;i<params.length;i++){443 if (dcsqry.indexOf(params[i]+"=")!=-1){444 WT.srch="1";445 break;446 }447 }448 }449 if ((window.document.referrer!="")&&(window.document.referrer!="-")){450 if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){451 DCS.dcsref=window.document.referrer;452 }453 }454455 DCS["dcscfg"] = this.TPCConfig.cfgType;456 457}458WebTrends.prototype.dcsEscape=function(S, REL){459 if (REL!=""){460 S=S.toString();461 for (var R in REL){462 if (REL[R] instanceof RegExp){463 S=S.replace(REL[R],R);464 }465 }466 return S;467 }468 else{469 return escape(S);470 }471}472WebTrends.prototype.dcsA=function(N,V){473 if (this.i18n&&(this.exre!="")&&!this.exre.test(N)){474 if (N=="dcsqry"){475 var newV="";476 var params=V.substring(1).split("&");477 for (var i=0;i<params.length;i++){478 var pair=params[i];479 var pos=pair.indexOf("=");480 if (pos!=-1){481 var key=pair.substring(0,pos);482 var val=pair.substring(pos+1);483 if (i!=0){484 newV+="&";485 }486 newV+=key+"="+this.dcsEncode(val);487 }488 }489 V=V.substring(0,1)+newV;490 }491 else{492 V=this.dcsEncode(V);493 }494 }495 return "&"+N+"="+this.dcsEscape(V, this.re);496}497WebTrends.prototype.dcsEncode=function(S){498 return (typeof(encodeURIComponent)=="function")?encodeURIComponent(S):escape(S);499}500WebTrends.prototype.dcsCreateImage=function(dcsSrc){501 if (document.images){502 this.images[this.index]=new Image();503 this.images[this.index].src=dcsSrc;504 this.index++;505 }506}507WebTrends.prototype.dcsMeta=function(){508 var elems;509 if (document.documentElement){510 elems=document.getElementsByTagName("meta");511 }512 else if (document.all){513 elems=document.all.tags("meta");514 }515 if (typeof(elems)!="undefined"){516 var length=elems.length;517 for (var i=0;i<length;i++){518 var name=elems.item(i).name;519 var content=elems.item(i).content;520 var equiv=elems.item(i).httpEquiv;521 if (name.length>0){522 if (name.toUpperCase().indexOf("WT.")==0){523 this.WT[name.substring(3)]=content;524 }525 else if (name.toUpperCase().indexOf("DCSEXT.")==0){526 this.DCSext[name.substring(7)]=content;527 }528 else if (name.toUpperCase().indexOf("DCS.")==0){529 this.DCS[name.substring(4)]=content;530 }531 }532 }533 }534}535WebTrends.prototype.dcsTag=function(){536 if (document.cookie.indexOf("WTLOPTOUT=")!=-1){537 return;538 }539 var WT=this.WT;540 var DCS=this.DCS;541 var DCSext=this.DCSext;542 var i18n=this.i18n;543 var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+(this.dcsid==""?'':'/'+this.dcsid)+"/dcs.gif?";544 if (i18n){545 WT.dep="";546 }547 for (var N in DCS){548 if (DCS[N]&&(typeof DCS[N]!="function")){549 P+=this.dcsA(N,DCS[N]);550 }551 }552 for (N in WT){553 if (WT[N]&&(typeof WT[N]!="function")){554 P+=this.dcsA("WT."+N,WT[N]);555 }556 }557 for (N in DCSext){558 if (DCSext[N]&&(typeof DCSext[N]!="function")){559 if (i18n){560 WT.dep=(WT.dep.length==0)?N:(WT.dep+";"+N);561 }562 P+=this.dcsA(N,DCSext[N]);563 }564 }565 if (i18n&&(WT.dep.length>0)){566 P+=this.dcsA("WT.dep",WT.dep);567 }568 if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){569 P=P.substring(0,2040)+"&WT.tu=1";570 }571 this.dcsCreateImage(P);572 this.WT.ad="";573}574WebTrends.prototype.dcsDebug=function(){575 var t=this;576 var i=t.images[0].src;577 var q=i.indexOf("?");578 var r=i.substring(0,q).split("/");579 var m="<b>Protocol</b><br><code>"+r[0]+"<br></code>";580 m+="<b>Domain</b><br><code>"+r[2]+"<br></code>";581 m+="<b>Path</b><br><code>/"+r[3]+"/"+r[4]+"<br></code>";582 m+="<b>Query Params</b><code>"+i.substring(q+1).replace(/\&/g,"<br>")+"</code>";583 m+="<br><b>Cookies</b><br><code>"+document.cookie.replace(/\;/g,"<br>")+"</code>";584 if (t.w&&!t.w.closed){585 t.w.close();586 }587 t.w=window.open("","dcsDebug","width=500,height=650,scrollbars=yes,resizable=yes");588 t.w.document.write(m);589 t.w.focus();590}591WebTrends.prototype.dcsCollect=function(){592 if (this.enabled){593 this.dcsVar();594 this.dcsMeta();595 this.dcsAdv();596 if (typeof(this.dcsCustom)=="function"){597 this.dcsCustom();598 }599 this.dcsTag();600 }601}602603function dcsMultiTrack(){604 if (typeof(_tag)!="undefined"){605 return(_tag.dcsMultiTrack());606 }607}608609function dcsDebug(){610 if (typeof(_tag)!="undefined"){611 return(_tag.dcsDebug());612 }613}614615Function.prototype.wtbind = function(obj){616 var method=this;617 var temp=function(){618 return method.apply(obj,arguments);619 };620 return temp; ...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1/* CUSTOM FUNCTION WRITE HERE*/2"use strict";3jQuery(document).on('ready', function() {4 /* MOBILE MENU*/5 // function collapseMenu(){6 // jQuery('.wt-navigation ul li.menu-item-has-children, .wt-navdashboard ul li.menu-item-has-children, .wt-navigation ul li.menu-item-has-mega-menu').prepend('<span class="wt-dropdowarrow"><i class="lnr lnr-chevron-right"></i></span>');7 // jQuery('.wt-navigation ul li.menu-item-has-children span, .wt-navdashboard ul li.menu-item-has-children span, .wt-navigation ul li.menu-item-has-mega-menu span').on('click', function() {8 // jQuery(this).parent('li').toggleClass('wt-open');9 // jQuery(this).next().next().slideToggle(300);10 // });11 // }12 // collapseMenu();13 /* PROGRESS BAR */14 if(jQuery('#wt-ourskill').length > 0){15 var _wt_ourskill = jQuery('#wt-ourskill');16 _wt_ourskill.appear(function () {17 jQuery('.skill-holder').each(function () {18 jQuery(this).find('.skill-bar').animate({19 width: jQuery(this).attr('data-percent')20 }, 2500);21 });22 });23 }24 /* Google Map */25 if(jQuery('#wt-locationmap').length > 0){26 var _wt_locationmap = jQuery('#wt-locationmap');27 _wt_locationmap.gmap3({28 marker: {29 address: '1600 Elizabeth St, Melbourne, Victoria, Australia',30 options: {31 title: 'Robert Frost Elementary School'32 }33 },34 map: {35 options: {36 zoom: 16,37 scrollwheel: false,38 disableDoubleClickZoom: true,39 }40 }41 });42 }43 /*OPEN CLOSE */44 jQuery('#wt-loginbtn, .wt-loginheader a').on('click', function(event){45 event.preventDefault();46 jQuery('.wt-loginarea .wt-loginformhold').slideToggle();47 });48 /*OPEN CLOSE */49 jQuery('.wt-dropdown').on('click', function(event){50 event.preventDefault();51 jQuery('.wt-radioholder').slideToggle();52 });53 /* BANNER VIDEO */54 jQuery("a[data-rel]").each(function () {55 jQuery(this).attr("rel", jQuery(this).data("rel"));56 });57 jQuery("a[data-rel^='prettyPhoto']").prettyPhoto({58 animation_speed: 'normal',59 theme: 'dark_square',60 slideshow: 3000,61 autoplay_slideshow: false, 62 social_tools: false63 });64 /* DROPDOWN RADIO */65 jQuery('input:radio[name="searchtype"]').change(66 function(){67 var _type = jQuery(this).data('title');68 jQuery('.selected-search-type').html(_type);69 }70 );71 /* COUNTER */72 try {73 var _wt_statistics = jQuery('#wt-statistics');74 _wt_statistics.appear(function () {75 var _wt_statistics = jQuery('.wt-statisticcontent h3');76 _wt_statistics.countTo({77 formatter: function (value, options) {78 return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');79 }80 });81 });82 } catch (err) {}83 /* Team Slider */84 var _wt_teamslider = jQuery("#wt-teamslider")85 _wt_teamslider.owlCarousel({86 item: 6,87 loop:true,88 nav:false,89 margin: 30,90 animateIn: "fadeIn",91 autoplay:false,92 responsiveClass:true,93 responsive:{94 0:{items:1,},95 481:{items:2,},96 768:{items:3,},97 992:{items:4,}98 }99 });100 /* Brand Slider */101 var _wt_brandslider = jQuery("#wt-brandslider")102 _wt_brandslider.owlCarousel({103 item: 6,104 loop:false,105 nav:false,106 margin: 0,107 autoplay:false,108 responsiveClass:true,109 responsive:{110 0:{items:1,},111 481:{items:2,},112 768:{items:3,},113 991:{items:4,},114 992:{items:5,}115 }116 });117 $('#accordion').collapse({118 toggle: false 119 })120 /* Team Slider */121 var _wt_categoriesslider = jQuery("#wt-categoriesslider")122 _wt_categoriesslider.owlCarousel({123 item: 6,124 loop:true,125 nav:false,126 margin: 0,127 autoplay:false,128 center: true,129 responsiveClass:true,130 responsive:{131 0:{items:1,},132 481:{items:2,},133 768:{items:3,},134 1440:{items:4,},135 1760:{items:6,}136 }137 });138 /* THEME VERTICAL SCROLLBAR */139 jQuery('#wt-getsupport').on('click', function(){140 jQuery('.wt-chatbox').slideToggle();141 });142 if(jQuery('.wt-verticalscrollbar').length > 0){143 var _wt_verticalscrollbar = jQuery('.wt-verticalscrollbar');144 _wt_verticalscrollbar.mCustomScrollbar({145 axis:"y",146 });147 }148 if(jQuery('.wt-horizontalthemescrollbar').length > 0){149 var _wt_horizontalthemescrollbar = jQuery('.wt-horizontalthemescrollbar');150 _wt_horizontalthemescrollbar.mCustomScrollbar({151 axis:"x",152 advanced:{autoExpandHorizontalScroll:true},153 });154 }155 /* TIPSO TOOLTIP */156 jQuery('.template-content').tipso({157 speed : 400, 158 background : '#fff',159 titleBackground : '#3498db',160 color : '#999999',161 titleColor : '#ffffff',162 width : 105,163 tooltipHover : true,164 size :50,165 offsetY : 0,166 position: 'top-right'167 });168 jQuery('.hover-tipso-tooltip').tipso({169 tooltipHover: true,170 });171 /* CONSULTATION FEE SLIDER */172 function ageRangeslider(){173 jQuery("#wt-productrangeslider").slider({174 range: true,175 min: 0,176 max: 150,177 values: [ 10, 110 ],178 slide: function( event, ui ) {179 jQuery( "#wt-consultationfeeamount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );180 }181 });182 jQuery( "#wt-consultationfeeamount" ).val( "$" + jQuery("#wt-productrangeslider").slider( "values", 0 ) + " - $" + jQuery("#wt-productrangeslider").slider( "values", 1 ));183 }184 if( jQuery("#wt-productrangeslider").length > 0 ){185 ageRangeslider();186 }187 /* SHORT DESCRIPTION */188 var _readmore = jQuery('.wt-userdetails .wt-description');189 _readmore.readmore({190 speed: 500,191 collapsedHeight: 230,192 moreLink: '<a class="wt-btntext" href="#">Read More</a>',193 lessLink: '<a class="wt-btntext" href="#">Less</a>',194 });195 /* PROGRESS BAR */196 try {197 $('#wt-ourskill').appear(function () {198 jQuery('.wt-skillholder').each(function () {199 jQuery(this).find('.wt-skillbar').animate({200 width: jQuery(this).attr('data-percent')201 }, 2500);202 });203 });204 } catch (err) {}205 /* PRELOADER*/206 jQuery(window).load(function() {207 jQuery(".preloader-outer").delay(1000).fadeOut();208 jQuery(".loader").delay(500).fadeOut("slow");209 });210 /*OPEN CLOSE */211 jQuery('.wt-projectdropdown').on('click', function(event){212 event.preventDefault();213 jQuery('.wt-projectdropdown-option').slideToggle();214 });215 /* DROPDOWN RADIO */216 jQuery('input:radio[name="searchtype"]').change(217 function(){218 var _type = jQuery(this).data('title');219 jQuery('.selected-search-type').html(_type);220 }221 );222 /* SIDEBAR DROPDOWN */223 jQuery('.wt-usersidebardown').on('click', function(event){224 event.preventDefault();225 jQuery('.wt-usersidebar').slideToggle();226 });227 /* Lost passowrd Box */228 jQuery('.wt-forgot-password').on('click', function (e) { 229 jQuery('.do-login-form').addClass('wt-hide-form');230 jQuery('.wt-loginheader span').html('Reset Password');231 jQuery('.do-forgot-password-form').removeClass('wt-hide-form');232 });233 jQuery('.wt-show-login').on('click', function (e) { 234 jQuery('.do-login-form').removeClass('wt-hide-form');235 jQuery('.wt-loginheader span').text('Login');236 jQuery('.do-forgot-password-form').addClass('wt-hide-form');237 });238 /* SEARCH CHOSEN */239 var config = {240 '.chosen-select' : {},241 '.chosen-select-deselect' : {allow_single_deselect:true},242 '.chosen-select-no-single' : {disable_search_threshold:10},243 '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},244 '.chosen-select-width' : {width:"95%"}245 }246 for (var selector in config) {247 jQuery(selector).chosen(config[selector]);248 }249 /* DASHBOARD MENU */250 if(jQuery('#wt-btnmenutoggle').length > 0){251 jQuery("#wt-btnmenutoggle").on('click', function(event) {252 event.preventDefault();253 jQuery('#wt-wrapper').toggleClass('wt-openmenu');254 jQuery('body').toggleClass('wt-noscroll');255 jQuery('.wt-navdashboard ul.sub-menu').hide();256 });257 }258 /* FIXED SIDEBAR */259 function fixedNav(){ 260 $(window).scroll(function () { 261 var $pscroll = $(window).scrollTop(); 262 if($pscroll > 76){263 $('.wt-sidebarwrapper').addClass('jf-fixednav');264 }else{265 $('.wt-sidebarwrapper').removeClass('jf-fixednav');266 }267 });268 }269 fixedNav();270 /* ADD Class */271 jQuery('.wt-addinfo').addClass('wt-skillsaddinfo');272 jQuery('.wt-myskills > ul > li').on('click', function() {273 jQuery(this).addClass('wt-skillsaddinfo').siblings().removeClass('wt-skillsaddinfo');274 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('www.webpagetest.org');3 if (err) return console.error(err);4 console.log(data);5});6var wt = require('webpagetest');7var wpt = new wt('www.webpagetest.org');8 if (err) return console.error(err);9 console.log(data);10});11var wt = require('webpagetest');12var wpt = new wt('www.webpagetest.org');13 if (err) return console.error(err);14 console.log(data);15});16var wt = require('webpagetest');17var wpt = new wt('www.webpagetest.org');18 if (err) return console.error(err);19 console.log(data);20});21var wt = require('webpagetest');22var wpt = new wt('www.webpagetest.org');23 if (err) return console.error(err);24 console.log(data);25});26var wt = require('webpagetest');27var wpt = new wt('www.webpagetest.org');28 if (err) return console.error(err);29 console.log(data);30});31var wt = require('webpagetest');32var wpt = new wt('www.webpagetest.org');33 if (err) return console.error(err);34 console.log(data);35});36var wt = require('webpagetest');37var wpt = new wt('www.webpagetest.org');38 if (err

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.page('Barack_Obama').then(function(page) {3 var wt = page.wt();4 var infobox = wt.infobox();5 console.log(infobox);6});7@viveksharmauiuc:disqus I’m not sure what the problem is. The code you posted works for me. Can you try updating to the latest version of wptools (3.3.0) and let me know if it works?8var wptools = require('wptools');9wptools.page('Barack_Obama').then(function(page) {10 var wt = page.wt();11 var infobox = wt.infobox();12 console.log(infobox);13});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2wptools.page('Albert Einstein').get((err, page) => {3 console.log(page.data.wt);4});5const wptools = require('wptools');6wptools.page('Albert Einstein').get((err, page) => {7 console.log(page.data.wikitext);8});9const wptools = require('wptools');10wptools.page('Albert Einstein').get((err, page) => {11 console.log(page.data.wikitext);12});13const wptools = require('wptools');14wptools.page('Albert Einstein').get((err, page) => {15 console.log(page.data.wikitext);16});17const wptools = require('wptools');18wptools.page('Albert Einstein').get((err, page) => {19 console.log(page.data.wikitext);20});21const wptools = require('wptools');22wptools.page('Albert Einstein').get((err, page) => {23 console.log(page.data.wikitext);24});25const wptools = require('wptools');26wptools.page('Albert Einstein').get((err, page) => {27 console.log(page.data.wikitext);28});29const wptools = require('wptools');30wptools.page('Albert Einstein').get((err, page) => {31 console.log(page.data.wikitext);32});33const wptools = require('wptools');34wptools.page('Albert Einstein').get((err, page) => {35 console.log(page.data.wikitext);36});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wiki = wptools.page('wikipedia', 'Barack Obama');3wiki.get(function(err, resp) {4 if (!err) {5 console.log(resp);6 }7});8var wiki = wptools.wiki;9wiki.page('wikipedia', 'Barack Obama', function(err, resp) {10 if (!err) {11 console.log(resp);12 }13});14var wiki = wptools.wiki;15wiki.page('wikipedia', 'Barack Obama', function(err, resp) {16 if (!err) {17 console.log(resp);18 }19}, function(err, resp) {20 if (!err) {21 console.log(resp);22 }23});24var wiki = wptools.wiki;25wiki.page('wikipedia', 'Barack Obama', function(err, resp) {26 if (!err) {27 console.log(resp);28 }29}, function(err, resp) {30 if (!err) {31 console.log(resp);32 }33}, {34});35var wiki = wptools.wiki;36wiki.page('wikipedia', 'Barack Obama', function(err, resp) {37 if (!err) {38 console.log(resp);39 }40}, function(err, resp) {41 if (!err) {42 console.log(resp);43 }44}, {45}, 'en', 'json');46var wiki = wptools.wiki;47wiki.page('wikipedia', 'Barack Obama', function(err, resp) {48 if (!err) {49 console.log(resp);50 }51}, function(err, resp) {52 if (!err) {53 console.log(resp);54 }55}, {56}, 'en', 'json', function(err, resp) {57 if (!err) {58 console.log(resp);59 }60});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wp = wptools.page('Barack Obama');3wp.get(function(err, resp) {4 console.log(resp);5});6var wptools = require('wptools');7var wp = wptools.page('Barack Obama');8wp.wtf(function(err, resp) {9 console.log(resp);10});11var wptools = require('wptools');12var wp = wptools.page('Barack Obama');13wp.wtf(function(err, resp) {14 console.log(resp);15});16var wptools = require('wptools');17var wp = wptools.page('Barack Obama');18wp.wtf(function(err, resp) {19 console.log(resp);20});21var wptools = require('wptools');22var wp = wptools.page('Barack Obama');23wp.wtf(function(err, resp) {24 console.log(resp);25});26var wptools = require('wptools');27var wp = wptools.page('Barack Obama');28wp.wtf(function(err, resp) {29 console.log(resp);30});31var wptools = require('wptools');32var wp = wptools.page('Barack Obama');33wp.wtf(function(err, resp) {34 console.log(resp);35});36var wptools = require('wptools');37var wp = wptools.page('Barack Obama');38wp.wtf(function(err, resp) {39 console.log(resp);40});41var wptools = require('wptools');42var wp = wptools.page('Barack Obama');43wp.wtf(function(err, resp) {44 console.log(resp);45});46var wptools = require('wptools');47var wp = wptools.page('Barack Obama');48wp.wtf(function(err, resp) {49 console.log(resp);50});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require("wptools");2var wt = wptools.wt;3wt("Albert Einstein").then(function(page) {4 console.log(page);5 console.log(page.infobox());6 console.log(page.infobox("birth_date"));7 console.log(page.infobox("birth_date", "date"));8 console.log(page.infobox("birth_date", "date", "year"));9});10var wptools = require("wptools");11var wtf_wikipedia = wptools.wtf_wikipedia;12wtf_wikipedia.from_api("Albert Einstein", "en").then(function(page) {13 console.log(page);14 console.log(page.infobox());15 console.log(page.infobox("birth_date"));16 console.log(page.infobox("birth_date", "date"));17 console.log(page.infobox("birth_date", "date", "year"));18});19var wptools = require("wptools");20var wtf_wikipedia = wptools.wtf_wikipedia;21wtf_wikipedia.from_api("Albert Einstein", "en").then(function(page) {22 console.log(page);23 console.log(page.infobox());24 console.log(page.infobox("birth_date"));25 console.log(page.infobox("birth_date", "date"));26 console.log(page.infobox("birth_date", "date", "year"));27});28var wptools = require("wptools");29var wtf_wikipedia = wptools.wtf_wikipedia;30wtf_wikipedia.from_api("Albert Einstein", "en").then(function(page) {31 console.log(page);32 console.log(page.infobox());33 console.log(page.infobox("birth_date"));34 console.log(page.infobox("birth_date", "date"));35 console.log(page.infobox("birth_date", "date", "year"));36});37var wptools = require("wptools");38var wtf_wikipedia = wptools.wtf_wikipedia;39wtf_wikipedia.from_api("Albert Einstein", "en").then(function(page) {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var test = function(){3 wptools.wt('Barack Obama', function(err, res){4 console.log(res);5 });6};7test();8 at exports._errnoException (util.js:870:11)9 at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)10 at onErrorNT (internal/child_process.js:344:16)11 at _combinedTickCallback (node.js:377:13)12 at process._tickCallback (node.js:401:11)13var wptools = require('wptools');14var test = function(){15 wptools.wt('Barack Obama', function(err, res){16 console.log(res);17 });18};19test();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful