LA CLASSE CLE: vidéo
A la découverte d'une classe CLE
fireshotsSites = { "amazon":{ "name": "Amazon", "regex": /^http://(.*.|)amazon.com/, "params": {"ro": "1","sb": "1"}}, "aol":{ "name": "AOL Search", "regex": /^http://.*.aol..*/aol/search?/, "params": {"ap": "0", "hdd": "1500"}}, "ask":{ "name": "Ask Search", "regex": /^http://www.ask.com/web?/, "params": {"ap": "0", "hdd": "1500", "si": "0"}}, "baidu":{ "name": "Baidu", "regex": /^http://www.baidu.com/s?/, "params": {"ap": "1", "hdd": "1500", "si": "0"}}, "blogdotcom":{ "name": "Blog.com", "regex": /^http://.*.blog.com/, "params": {"sb": "1", "si": "0", "ap": "0"}}, "blogger":{ "name": "Blogger", "regex": /^http://.*.blogspot.com//, "params": {"sb": "1", "ap": "1", "si": "0"}}, "bloglines":{ "name": "Bloglines", "regex": /^http://www.bloglines.com/myblogs_display?/, "params": {"ap": "0", "sb": "1", "si": "0", "framed":"1"}}, "boingboing":{ "name": "Boing Boing", "regex": /^http://(.*.|)boingboing.net/, "params": {"ap": "0", "sb": "1", "si": "0"}}, "drudgereport":{ "name": "Drudge Report", "regex": /^http://(.*.|)drudgereport.com/, "params": {"sb": "1"}}, "gawkermedia":{ "name": "Gawker Media sites", "regex": /^http://(.*.|)(gawker|defamer|wonkette|idolator|jalopnik|fleshbot|kotaku|deadspin|gridskipper|consumerist|gizmodo|valleywag|lifehacker|jezebel).com//, "params": {"ap": "0", "sb": "1", "si": "0"}}, "googlenews":{ "name": "Google News", "regex": /^http://news.google.com/, "params": {"si":"0"}}, "googlereader":{ "name": "Google Reader", "regex": /^http://www.google.com/reader/view/, "params": {"ap": "0", "sb": "1", "rs": "1","tp":"0", "si": "0"}}, "google":{ "name": "Google Search", "regex": /^http://.*.google..*/(search|custom)?/, "params": {"ap": "0", "hdd": "1500"}}, "googlevid":{ "name": "Google Video", "regex": /^http://video.google.com/, "params": {"ro": "1", "sb": "1"}}, "huffingtonpost":{ "name": "Huffington Post", "regex": /^http://(.*.|)huffingtonpost.com/, "params": {"sb": "1", "si": "0"}}, "imdb":{ "name": "IMDb", "regex": /^http://(.*.|)imdb.com/, "params": {"ro": "1", "ap": "0","sb": "1"}}, "lycos":{ "name": "Lycos Search", "regex": /^http://search.lycos.com/, "params": {"ap": "0", "sb": "0", "hdd": "1500"}}, "metacafe":{ "name": "Metacafe Video", "regex": /^http://(.*.|)metacafe.com/, "params": {"sb": "1", "ro": "1"}}, "live":{ "name": "MSN Live Search", "regex": /^http://search.(live|msn).com/results.aspx?/, "params": {"ap": "0", "hdd": "1500"}}, "myspace":{ "name": "MySpace", "regex": /^http://(.*.|)myspace.com/, "params": {"sb": "1", "ap": "0"}}, "marketwatch":{ "name": "MarketWatch", "regex": /^http://(.*.|)marketwatch.com/, "params": {"ro": "1", "sb":"1", "rse":"marketwatch.com"}}, "netvibes":{ "name": "NetVibes", "regex": /^http://www.netvibes.com//, "params": {"ap": "0", "sb": "1", "rs": "1","tp":"0"}}, "revver":{ "name": "Revver Video", "regex": /^http://(.*.|)revver.com/, "params": {"sb": "1", "ro": "1"}}, "typepad":{ "name": "TypePad", "regex": /^http://(.*.|)typepad.com/, "meta": [{"name":"generator","content":"http://www.typepad.com/"}], "params": {"sb": "1", "ap": "0", "si": "0"}}, "veoh":{ "name": "Veoh Video", "regex": /^http://(.*.|)veoh.com/, "params": {"sb": "1","ro": "1"}}, "vox":{ "name": "Vox", "regex": /^http://(.*.|)vox.com/, "params": {"sb": "1", "ap": "0"}}, "wikipedia":{ "name": "Wikipedia", "regex": /^http://.*.wikipedia.org/wiki/.+/, "params": {"sb": "1", "link_icon": "0", "ap": "0"}}, "xanga":{ "name": "Xanga Video", "regex": /^http://(.*.|)xanga.com/, "params": {"sb": "1", "ro": "1", "fl": "xanga", "tp":"0"}}, "yahoo":{ "name": "Yahoo Search", "regex": /^http://.*.yahoo..*/search/, "params": {"ap": "0", "hdd": "1500"}} }; fireshotsBlacklistedSites = new Array( /^http://.*.snap.com/, /^http://.*.googlesyndication.com/, /^http://(w+.)*gmail.com/, /^http://mail.google.com/, /^http://(w*.)*flickr.com/, /^http://(w*.)*alltheweb.com/, /^http://picasaweb.google.com/, /^http://(w*.)*youtube.com/, /^http://(w*.)*photobucket.com/, /^http://(w*.)*wikipedia.org/$/, /^http://.*.monster.com/, /^http://money.cnn.com/ ); var unsafeWindow = window; SNAP_COM_CLIENT = new Object; SNAP_COM_CLIENT.fireshotsBlacklistedSites = fireshotsBlacklistedSites; SNAP_COM_CLIENT.fireshotsSites = fireshotsSites; SNAP_COM_CLIENT.sb = ''; SNAP_COM_CLIENT.size = ''; SNAP_COM_CLIENT.baseShotHREF = 'http://shots.snap.com'; SNAP_COM_CLIENT.disabledSites = ''; SNAP_COM_CLIENT.si = 0; SNAP_COM_CLIENT.key = 'c70a74d85f2a0701afadd9c55a05574a'; SNAP_COM_CLIENT.th = 'silver'; SNAP_COM_CLIENT.link_icon = 'on'; SNAP_COM_CLIENT.shots_trigger = 'both'; SNAP_COM_CLIENT.lang = 'en-us'; SNAP_COM_CLIENT.domain = ''; SNAP_COM_CLIENT.campaign = 'addon_ie_build80'; function SNAP_COM_CLIENT_SHOTSSETUP() { var url = location.href; // the following must be defined before this js is used // SNAP_COM_CLIENT.fireshotsBlacklistedSites; // SNAP_COM_CLIENT.fireshotsSites; // the following are various settings that should be defined, otherwise the defaults are used if (typeof SNAP_COM_CLIENT.disabledSites == "undefined") SNAP_COM_CLIENT.disabledSites = ""; if (typeof SNAP_COM_CLIENT.si == "undefined") SNAP_COM_CLIENT.si = 1; if (typeof SNAP_COM_CLIENT.key == "undefined") SNAP_COM_CLIENT.key = "invalidkey"; if (typeof SNAP_COM_CLIENT.th == "undefined") SNAP_COM_CLIENT.th = 'silver'; if (typeof SNAP_COM_CLIENT.sb == "undefined" || SNAP_COM_CLIENT.sb == '') SNAP_COM_CLIENT.sb = 1; if (typeof SNAP_COM_CLIENT.link_icon == "undefined") SNAP_COM_CLIENT.link_icon = 'on'; if (typeof SNAP_COM_CLIENT.shots_trigger == "undefined") SNAP_COM_CLIENT.shots_trigger = 'both'; if (typeof SNAP_COM_CLIENT.size == "undefined") SNAP_COM_CLIENT.size = 'small'; if (typeof SNAP_COM_CLIENT.lang == "undefined") SNAP_COM_CLIENT.lang = 'en-us'; if (typeof SNAP_COM_CLIENT.domain == "undefined") SNAP_COM_CLIENT.domain = ''; if (typeof SNAP_COM_CLIENT.source == "undefined") SNAP_COM_CLIENT.source = ''; if (typeof SNAP_COM_CLIENT.campaign == "undefined") SNAP_COM_CLIENT.campaign = 'unknown_campaign'; var params = {}; var blacklisted = false; for (var x=0; x < SNAP_COM_CLIENT.fireshotsBlacklistedSites.length; x++) { if(url.match(SNAP_COM_CLIENT.fireshotsBlacklistedSites[x])){ //alert("blacklisted!"); blacklisted = true; break; } } if(!blacklisted){ var site_name; var frameOverride = false; var metaTags = document.getElementsByTagName('meta'); var metaTagLength = metaTags.length; for(var key in SNAP_COM_CLIENT.fireshotsSites){ if(url.match(SNAP_COM_CLIENT.fireshotsSites[key].regex)){ site_name = key; break; } fireshotsMeta = SNAP_COM_CLIENT.fireshotsSites[key].meta; if (typeof site_name == "undefined" && fireshotsMeta) { for (var i = 0; i < fireshotsMeta.length; i++) { var desired_meta_object = fireshotsMeta[i]; for (var j = 0; j < metaTagLength; j++) { found = true; var meta_object = metaTags[j]; for (var meta_key in desired_meta_object) { if (meta_object[meta_key] != desired_meta_object[meta_key]) { found = false; } } if (found) site_name = key; } } } } var disabled = false; params['ro'] = "0"; if(site_name){ site_name = site_name; var disabledSites = SNAP_COM_CLIENT.disabledSites.split(","); for(var i in disabledSites){ if(key == disabledSites[i]){ disabled = true break; } } }else{ site_name = ""; params['ro'] = "1"; } } if(disabled || blacklisted){ //alert("user has disabled " + site_name); }else{ params['ap'] = "1"; params['tc'] = "0"; params['tp'] = "1"; params['hdd'] = "1500"; params['si'] = SNAP_COM_CLIENT.si;//prefManager.getCharPref("extensions.fireshots.si"); params['key'] = SNAP_COM_CLIENT.key;//prefManager.getCharPref("extensions.fireshots.key"); params['th'] = SNAP_COM_CLIENT.th;//prefManager.getCharPref("extensions.fireshots.th"); params['sb'] = SNAP_COM_CLIENT.sb;//prefManager.getCharPref("extensions.fireshots.sb"); params['link_icon'] = SNAP_COM_CLIENT.link_icon;//prefManager.getCharPref("extensions.fireshots.link_icon"); params['shots_trigger'] = SNAP_COM_CLIENT.shots_trigger;//prefManager.getCharPref("extensions.fireshots.shots_trigger"); params['size'] = SNAP_COM_CLIENT.size;//prefManager.getCharPref("extensions.fireshots.size"); params['lang'] = SNAP_COM_CLIENT.lang;//prefManager.getCharPref("extensions.fireshots.lang"); params['domain'] = SNAP_COM_CLIENT.domain;//'ffex_' + version; params['source'] = SNAP_COM_CLIENT.source; params['campaign'] = SNAP_COM_CLIENT.campaign; if(site_name){ params['si'] = "1"; params['tc'] = "15"; params['sb'] = "0"; } //override params with what we've definite in sites.js if(site_name && SNAP_COM_CLIENT.fireshotsSites[site_name].params) { for(var param_name in SNAP_COM_CLIENT.fireshotsSites[site_name].params){ params[param_name] = SNAP_COM_CLIENT.fireshotsSites[site_name].params[param_name]; } } if(params['framed']){ frameOverride = true; } unsafeWindow.frameOverride = frameOverride; //create an argument string param_pairs = new Array(); for(var param_name in params){ param_pairs.push(param_name + "=" + params[param_name]); } params = params; shots_url = SNAP_COM_CLIENT.baseShotHREF + '/snap_shots.js?' + param_pairs.join("&"); unsafeWindow.shots_url = shots_url; unsafeWindow.site_name = site_name; var inject_url = SNAP_COM_CLIENT.baseShotHREF + '/client/inject.js?site_name='; if(site_name){ inject_url += site_name; }else{ inject_url += "0"; } var doc_body_array = window.document.getElementsByTagName("body"); if(doc_body_array){ doc_body = doc_body_array[0]; if (doc_body) { var shots = document.createElement('script'); shots.type = 'text/javascript'; shots.src = inject_url; doc_body.appendChild(shots); } } } } SNAP_COM_CLIENT_SHOTSSETUP();