Advertisement
w0lfiesmith

Sample Feedly link source code

Dec 10th, 2013
1,653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 15.10 KB | None | 0 0
  1. <html>
  2. <head>
  3. <!-- MODEL AND METADATA CODE -->
  4.     <title>Accused of Cyberspying, Huawei Is 'Exiting the U.S. Market' (Foreign Policy)</title>
  5. <link rel="publisher" href="https://plus.google.com/+feedly">
  6. <link rel="canonical" href="http://www.techmeme.com/131202/p30#a131202p30">
  7.     <link rel="alternate" type="application/rss+xml" title="Techmeme" href="http://www.techmeme.com/index.xml" />
  8.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  9.     <meta name="description" content="Accused of Cyberspying, Huawei Is 'Exiting the U.S. Market' (Foreign Policy)" />
  10.     <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"></meta>
  11.     <!-- Facebook -->
  12.     <meta property="fb:app_id" content="129765800430121" />
  13.     <meta property="og:description" content="Foreign Policy: Accused of Cyberspying, Huawei Is ‘Exiting the U.S. Market’&nbsp; —&nbsp; The CEO..." />
  14.     <meta property="og:site_name" content="Techmeme" />
  15.     <meta property="og:title" content="Accused of Cyberspying, Huawei Is 'Exiting the U.S. Market' (Foreign Policy)" />
  16.     <meta property="og:type" content="article" />
  17.    
  18.     <meta property="og:image" content="http://killerapps.foreignpolicy.com/files/166021322_copy_0.jpg" />
  19.    
  20.    
  21.     <!-- Twitter -->
  22. <meta name="twitter:card" content="summary">
  23.     <meta name="twitter:title" content="Accused of Cyberspying, Huawei Is 'Exiting the U.S. Market' (Foreign Policy)" />
  24.     <meta name="twitter:description" content="Foreign Policy: Accused of Cyberspying, Huawei Is ‘Exiting the U.S. Market’&nbsp; —&nbsp; The CEO..." />
  25.    
  26.     <meta name="twitter:image" content="http://killerapps.foreignpolicy.com/files/166021322_copy_0.jpg"/>
  27.    
  28.    
  29. <meta name="twitter:app:name:iphone" content="feedly"/>
  30. <meta name="twitter:app:id:iphone" content="396069556"/>
  31. <!-- meta name="twitter:app:url:iphone" content="feedly://e/"/-->
  32. <meta name="twitter:app:name:ipad" content="feedly"/>
  33. <meta name="twitter:app:id:ipad" content="396069556"/>
  34. <!--  meta name="twitter:app:url:ipad" content="feedly://e/"/-->
  35. <meta name="twitter:app:name:googleplay" content="feedly"/>
  36. <meta name="twitter:app:id:googleplay" content="com.devhd.feedly"/>
  37. <!-- meta name="twitter:app:url:googleplay" content="feedly://e/"-->
  38.    
  39.     <script>
  40.     // JS Objects
  41.     var feedInfo = JSON.parse("{\"id\":\"feed\/http:\/\/www.techmeme.com\/index.xml\",\"topics\":[\"Tech\",\"Technology\"],\"language\":\"en\",\"subscribers\":22058,\"velocity\":308.0,\"title\":\"Techmeme\",\"website\":\"http:\/\/www.techmeme.com\/\",\"description\":\"Tech Web, page A1\"}");
  42.     var entry = JSON.parse("{\"id\":\"2M28YlE6ga87nQ\/iGGPV4RS8\/EMotvkbp32D5U3OGIw=_142b5941789:b3ff4cc:d5f09881\",\"visual\":{\"height\":415,\"width\":625,\"url\":\"http:\/\/killerapps.foreignpolicy.com\/files\/166021322_copy_0.jpg\",\"edgeCacheUrl\":\"http:\/\/lh3.ggpht.com\/EzNYaIEBbnqNNvMrVAxS5ghAdQj0tzzXQeIroVUip-TfK1Ic7c5rsojiExqFyLWSzd1zPKXlDSh5IGvg-UvMO4BAQLY\",\"contentType\":\"image\/jpeg\"},\"originId\":\"http:\/\/www.techmeme.com\/131202\/p30#a131202p30\",\"fingerprint\":\"e998abee\",\"alternate\":[{\"href\":\"http:\/\/www.techmeme.com\/131202\/p30#a131202p30\",\"type\":\"text\/html\"}],\"canonical\":[{\"href\":\"http:\/\/www.techmeme.com\/131202\/p30#a131202p30\",\"type\":\"text\/html\"}],\"summary\":{\"content\":\"<a href=\\\"http:\/\/killerapps.foreignpolicy.com\/posts\/2013\/12\/02\/accused_of_cyberspying_huawei_is_exiting_the_us_market\\\"><img hspace=\\\"4\\\" align=\\\"RIGHT\\\" src=\\\"http:\/\/www.techmeme.com\/131202\/i30.jpg\\\" border=\\\"0\\\" vspace=\\\"4\\\"><\/a>\\n<p><a title=\\\"Techmeme permalink\\\" href=\\\"http:\/\/www.techmeme.com\/131202\/p30#a131202p30\\\"><img height=\\\"12\\\" width=\\\"11\\\" src=\\\"http:\/\/www.techmeme.com\/img\/pml.png\\\"><\/a> <a href=\\\"http:\/\/www.foreignpolicy.com\/\\\">Foreign Policy<\/a>:<br>\\n<span><b><a href=\\\"http:\/\/killerapps.foreignpolicy.com\/posts\/2013\/12\/02\/accused_of_cyberspying_huawei_is_exiting_the_us_market\\\">Accused of Cyberspying, Huawei Is \u2018Exiting the U.S. Market\u2019<\/a><\/b><\/span>\u00A0 \u2014\u00A0 The CEO of the world\'s biggest telecommunications equipment maker, which for years has been labeled by U.S. officials as a proxy for Chinese military and intelligence agencies, says he\'s giving up on America.<\/p>\",\"direction\":\"ltr\"},\"published\":1386024607000,\"title\":\"Accused of Cyberspying, Huawei Is \'Exiting the U.S. Market\' (Foreign Policy)\",\"crawled\":1386025850761,\"origin\":{\"htmlUrl\":\"http:\/\/www.techmeme.com\/\",\"streamId\":\"feed\/http:\/\/www.techmeme.com\/index.xml\",\"title\":\"Techmeme\"},\"sid\":\"0:j19YwTbIJMGUh\/XJTsXBdJ27BhmfbyPkmsmd3AQoh7A=\"}");
  43.     </script>    
  44. <!-- RENDERING CODE -->
  45. <style>
  46. body
  47. {
  48. margin : 0px;
  49. padding : 0px;
  50. font-family : sans-serif;
  51. text-rendering : optimizeLegibility;
  52. }
  53. .sizable
  54. {
  55. max-width       : 650px;
  56. }
  57. .entry
  58. {
  59. padding-top : 14px;
  60. padding-left : 14px;
  61. padding-right : 14px;
  62. margin-left : auto;
  63. margin-right : auto;
  64. }
  65. .title
  66. {
  67. font-size : 24px;
  68. line-height : 1.2em;
  69. margin-bottom : 6px;
  70. font-weight : 700;
  71. font-family : sans-serif;
  72. text-rendering : optimizeLegibility;
  73. letter-spacing  : -0.04em;
  74. cursor : pointer;
  75. }
  76. .engagement
  77. {
  78. margin-right    : 2px;
  79. color : #707070;
  80. }
  81. .metadata
  82. {
  83. color : #B3B3B2;
  84. font-size : 14px;
  85. line-height : 17px;
  86. overflow : hidden;
  87. margin-bottom   : 34px;
  88. }
  89. .content
  90. {
  91. color : #333333;
  92. line-height     : 1.5;
  93. font-family     : sans-serif;
  94. }
  95. .content a
  96. {
  97. color : inherit;
  98. text-decoration : none;
  99. font-weight     : bold;
  100. border-bottom : 1px dotted #333;
  101. }
  102. .content a:hover
  103. {
  104. text-decoration : none;
  105. font-weight     : bold;
  106. }
  107. .content frame
  108. {
  109. border : 0px;
  110. }
  111. .button
  112. {
  113. background-color: #6ABA45;
  114. font-size       : 13px;
  115. font-weight     : normal;
  116. font-style      : normal;
  117. color           : #FFF;
  118. cursor          : pointer;
  119. border-radius   : 3px;
  120. background-image: url( http://s3.feedly.com/img/follow-icon.png );
  121. background-repeat: no-repeat;
  122. background-size : 18px 16px;
  123. background-repeat: no-repeat;
  124. background-position: 8px center;
  125. font-weight : bold;
  126. color : #FFF;
  127. padding-left : 30px;
  128. padding-right : 8px;
  129. margin-left : 10px;
  130. line-height : 28px;
  131. display : inline-block;
  132. transition : all 0.3s linear;
  133. }
  134. .button:hover
  135. {
  136. background-color: #63A83F;
  137. }
  138. .secondary
  139. {
  140. font-size       : 13px;
  141. font-weight     : normal;
  142. font-style      : normal;
  143. color           : #A0A0A0;
  144. cursor          : pointer;
  145. margin-top  : 17px;
  146. margin-bottom  : 17px;
  147. border-bottom  : 1px solid #DDD;
  148. border-top  : 1px solid #DDD;
  149. display         : block;
  150. line-height     : 44px;
  151. color           : #999;
  152. text-decoration : none;
  153. text-align : center;
  154. transition : all 0.3s linear;
  155. }
  156.  
  157. .secondary:hover
  158. {
  159. color : #444;
  160. text-decoration : underline;
  161. }
  162. .footerHolder
  163. {
  164. cursor : pointer;
  165. }
  166. .footer
  167. {
  168. padding-left : 20px;
  169. padding-right : 20px;
  170. margin-left : auto;
  171. margin-right : auto;
  172. font-size : 12px;
  173. line-height : 1.2em;
  174. padding-top     : 14px;
  175. padding-bottom  : 14px;
  176. margin-bottom : 68px;
  177. }
  178. </style>
  179.  
  180. <script>
  181. window.onresize = adjustLayout;
  182. var visuals = 0;
  183. function adjustLayout()
  184. {
  185. var maxWidth = 650;
  186. if( maxWidth > document.body.clientWidth - 28 )
  187. maxWidth = document.body.clientWidth - 28
  188. var imgElems = document.getElementsByTagName( "img" );
  189. for( var i = 0; i < imgElems.length; i++ )
  190. {
  191. if( shouldExcludeVisual( imgElems[ i ].src ) )
  192. {
  193. imgElems[ i ].style.display = "none";
  194. }
  195. else
  196. {
  197. imgElems[ i ].style.maxWidth = maxWidth + "px";
  198. imgElems[ i ].style.width = null;
  199. imgElems[ i ].style.height = null;
  200. imgElems[ i ].removeAttribute( "width" );
  201. imgElems[ i ].removeAttribute( "height" );
  202. visuals++;
  203. }
  204. }
  205. }
  206. function layout()
  207. {
  208. // site
  209. fillElements( "site", entry.origin.title );
  210. // title
  211. fillElements( "title", entry.title );
  212. // enagement and engagement rate
  213. /*
  214. fillElements( "engagement", entry.engagement || "" );
  215. if( entry.engagementRate != null )
  216. element( "engagement" ).title = "How engaging is this story? (" + entry.engagementRate + ")";
  217.  
  218. if( entry.engagementRate != null && entry.engagementRate > 1.5 )
  219. element( "engagement" ).style.color = "#6ABA45";
  220. */
  221. // author
  222. if( entry.author != null && entry.author != "" )
  223. fillElements( "author", "by " + entry.author );
  224. else
  225. fillElements( "author", "" );
  226. // age
  227. var delta = new Date().getTime() - entry.crawled;
  228. fillElements( "age", prettyDuration( delta ) );
  229. // content
  230. var html = "";
  231. var direction = null;
  232. if( entry.content != null && entry.content.content != null )
  233. {
  234. html = entry.content.content;
  235. direction = entry.content.direction;
  236. }
  237. else if( entry.summary != null && entry.summary.content != null )
  238. {
  239. html = entry.summary.content;
  240. direction = entry.summary.direction
  241. }
  242. fillElements( "content", html );
  243. // site description
  244. fillElements( "description", feedInfo.description  );
  245. // site reader's count
  246. if( feedInfo.subscribers == null || isNaN( parseInt( feedInfo.subscribers ) ) || parseInt( feedInfo.subscribers ) < 2 )
  247. fillElements( "readers", "Be the first reader in feedly!"  );
  248. else
  249. fillElements( "readers", prettyNumber( feedInfo.subscribers ) + "&nbsp;readers&nbsp;in&nbsp;feedly"  );
  250.  
  251. // site topics
  252. var topics = "";
  253. if( feedInfo.topics != null )
  254. {
  255. for( var i = 0; i < feedInfo.topics.length && i < 3; i++ )
  256. topics += " #" + feedInfo.topics[ i ].toLowerCase();
  257. }
  258. fillElements( "topics", topics );
  259. }
  260. function element( id )
  261. {
  262. return document.getElementById( id );
  263. }
  264. function fillElements( className, html )
  265. {
  266. try
  267. {
  268. var elems = document.getElementsByClassName( className );
  269. for( var i = 0; i < elems.length; i++ )
  270. {
  271. elems[ i ].innerHTML = html || "";
  272. }
  273. }
  274. catch( ignore )
  275. {
  276. window.console.log( "[feedly] failed to fill elments:" + className );
  277. }
  278. }
  279. var RE_STRIP = /<\/?[^>]+>/gi;
  280. function asText()
  281. {
  282. // content
  283. var html = "";
  284. var direction = null;
  285. if( entry.content != null && entry.content.content != null )
  286. {
  287. html = entry.content.content;
  288. }
  289. else if( entry.summary != null && entry.summary.content != null )
  290. {
  291. html = entry.summary.content;
  292. }
  293.  
  294. return html.replace( RE_STRIP, '' );
  295. }
  296.  
  297. function prettyDuration( delta )
  298. {
  299. var seconds = delta / 1000;
  300. var days = Math.floor( seconds / ( 24 * 3600 ) );
  301. var hours = Math.floor( seconds / 3600 );
  302. var minutes = Math.floor( seconds / 60 );
  303. if( days == 0 )
  304. {
  305. if( hours < 1 )
  306. return Math.max( minutes, 1 ) + " min ago";
  307. else
  308. return hours + ( hours > 1 ? " hours ago" : " hour ago" )
  309. }
  310. else
  311. {
  312. return days + ( days > 1 ? " days ago" : " day ago" )
  313. }
  314. }
  315. function prettyNumber( n )
  316. {
  317. if( n == null || isNaN( parseInt( n ) ) )
  318. return "no";
  319. else if( n > 1000000 )
  320. return Math.floor( n/1000000 ) + "M";
  321. else if( n > 1000 )
  322. return Math.floor( n/1000 ) + "K";
  323. else
  324. return n;
  325. }
  326. var siteExcludePatterns = [ "/TheDigitalReader/" ];
  327.  
  328. function shouldExcludeSite( url )
  329. {
  330. for( var i = 0; i < siteExcludePatterns.length; i++ )
  331. {
  332. if( url.indexOf( siteExcludePatterns[ i ] ) > -1 )
  333. return true;
  334. }
  335. return false;
  336. };
  337.  
  338. var visualExcludePatterns = [  "feedproxy",
  339.   "feedburner",
  340. "/~",
  341. "feeds.wordpress.com",
  342. "stats.wordpress.com",
  343. "googleadservices.com",
  344. "feedads",
  345. "tweet-this",
  346.   "fmpub",
  347. "-ads",
  348. "_ads",
  349. "pheedo",
  350. "zemanta",
  351. "u.npr.org/iserver",
  352. "openx.org",
  353. "slashdot-it",
  354. "smilies",
  355. "/ico-",
  356. "commindo-media.de",
  357. "creatives.commindo-media",
  358. "doubleclick.net",
  359. "i.techcrunch",
  360. "adview",
  361. "/feed.gif",
  362. ".ads.",
  363. "/avw.php",
  364. "wp-digg-this",
  365. "feed-injector",
  366. "/plugins/",
  367. "tweetmeme.com",
  368. "_icon_",
  369. "/ad-",
  370. "share-buttons",
  371. "feedsportal.com",
  372. "buysellads",
  373. "holstee",
  374. "musictapp",
  375. "/ad_",
  376. "/button/",
  377. "donate.png",
  378. "/sponsors/",
  379. "googlesyndication.com",
  380. "/pagead",
  381. "/adx",
  382. "assets/feed-fb",
  383. "assets/feed-tw",
  384. "feedburner.com/~ff",
  385. "gstatic.com",
  386. "feedsportal.com"
  387. ];
  388. function shouldExcludeVisual( url )
  389. {
  390. for( var i = 0; i < visualExcludePatterns.length; i++ )
  391. {
  392. if( url.indexOf( visualExcludePatterns[ i ] ) > -1 )
  393. return true;
  394. }
  395. return false;
  396. };
  397.  
  398. function action( where )
  399. {
  400. var actionName = "follow";
  401. var url = "http://feedly.com/#" + encodeURIComponent( "subscription/" + feedInfo.id );
  402. if( /iPhone|iPad/i.test( navigator.userAgent ) )
  403. {
  404. actionName = "install";
  405. url = "http://itunes.apple.com/us/app/feedly/id396069556";
  406. }
  407. else if( /android/i.test( navigator.userAgent ) )
  408. {
  409. actionName = "install";
  410. url = "market://details?id=com.devhd.feedly";
  411. }
  412.         _gaq.push( [ '_trackEvent', bucket(), actionName + "." + where, feedInfo.id ] );
  413.         window.setTimeout( function() { document.location.href = url;},  20 );
  414. window.event.cancelBubble = true
  415. window.event.stopPropagation();
  416. window.event.preventDefault();
  417. }
  418.  
  419. function context()
  420. {
  421. if( /iPhone/i.test( navigator.userAgent ) )
  422. {
  423. return "iphone";
  424. }
  425. else if( /iPad/i.test( navigator.userAgent ) )
  426. {
  427. return "ipad";
  428. }
  429. else if( /android/i.test( navigator.userAgent ) )
  430. {
  431. return "android";
  432. }
  433. else
  434. {
  435. return "web";
  436. }
  437. }
  438.  
  439. function openSite( where )
  440. {
  441.         _gaq.push( [ "_trackEvent", bucket(), "open." + where, feedInfo.id ] );
  442.         window.setTimeout( function() { document.location.href = "http://www.techmeme.com/131202/p30#a131202p30"; },  20 );
  443. window.event.cancelBubble = true;
  444. window.event.stopPropagation();
  445. window.event.preventDefault();
  446. }
  447. </script>
  448. </head>
  449. <body>
  450. <div class="entry sizable">
  451. <div class="title" onclick="openSite( 'title' )">((title))</div>
  452. <div style="float:right; margin-top:3px">
  453. <span class="button" onclick="action( 'banner' )">Follow</span>
  454. </div>
  455. <div class="metadata" onclick="openSite( 'site' )">
  456. On <span class="site" style="color:#333332; cursor:pointer">((site))</span> by <span class="author">((author))</span><br>
  457. <span class="age">((age))</span>
  458. </div>
  459. <div onclick="openSite()" class="secondary">View website</div>
  460. <div class="content">((content))</div>
  461. <div onclick="openSite()" class="secondary">View comments</div>
  462. </div>
  463. <div class="footerHolder" onclick="openSite( 'footer' )">
  464. <div class="footer sizable">
  465. <div style="float:right">
  466. <span class="button" onclick="action( 'footer' )">Follow</span>
  467. </div>
  468. <div style="font-weight:bold; color:#666"><span class="site" >((site))</span></div>
  469. <div class="description">((description))</div>
  470. <span class="readers">((reader count))</span>
  471. <div class="topics">((topics))</div>
  472. </div>
  473. </div>
  474. <script>
  475. layout();
  476. adjustLayout();
  477. var kind = visuals == 0 && asText().length < 350 ? "partial" : "full";
  478.  
  479. function bucket()
  480. {
  481. return "v4.shorten." + kind + "." + context();
  482. }
  483. if( kind == "partial" || shouldExcludeSite( "http://www.techmeme.com/131202/p30#a131202p30" ) || true )
  484. {
  485. document.body.innerHTML = "";
  486. document.location.href = "http://www.techmeme.com/131202/p30#a131202p30";
  487. }
  488. else
  489. {
  490. // Init Google Analytics
  491.     var _gaq = _gaq || [];
  492.     _gaq.push(["_setAccount", "UA-3571881-5"]);
  493.     _gaq.push(["_trackEvent", bucket(), "shown", 'feed/http://www.techmeme.com/index.xml']);
  494.  
  495.     (function() {
  496.         var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  497.         ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  498.         var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  499.     })();
  500. }
  501. </script>
  502. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement