OPML弹出窗口简化播客聚合

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OPML弹出窗口简化播客聚合相关的知识,希望对你有一定的参考价值。

This is a website specific script... pops up the source of an OPML file with 145+ podcasts.
http://www.productivity501.com/2006/11/free_academic_p.html

Note: The 'bookmarklet' format is included as a comment at the bottom... (write in a webpage an anchor element with the escaped javascript format in the href attribute).
  1. /* 'Get Podcasts'
  2. * if isOPML is false, it pops up an escaped version in HTML.
  3. * if isOPML is true, it pops up an OPML version.
  4. * Either way, you need to copy and save the results as a file with an .opml extension
  5. * You can then add it to your Aggregator of choice:
  6. */
  7.  
  8. var isOPML=false;
  9. var entry=document.getElementById('entry-14040355');
  10. var ul=entry.getElementsByTagName('ul')[1];
  11. var links=ul.getElementsByTagName('a');
  12. var smalls=entry.getElementsByTagName('small');
  13. var names=[];var cond=false;var text=url=title="";
  14. for(var i=0;i<smalls.length;++i){
  15. cond=false;text=smalls[i].childNodes[0].nodeValue;
  16. for(var j=0;j<names.length;++j){
  17. if(text==names[j]){
  18. cond=true;
  19. }
  20. }
  21. if(!cond){
  22. names.push(text);
  23. }
  24. }
  25. //So far, names=["Purdue University","Southwest Tech","Berkeley","College of St. Scholastica","John Hopkins University","UCLA","Western Kentucky University","College of DuPage","NC State University","City University of New York","Ohio State University"];
  26. function filter(name){
  27. var t=output="";
  28. for(var k=0;k<links.length;++k){
  29. t=smalls[k].childNodes[0].nodeValue;
  30. if(t==name){
  31. url=links[k].href;
  32. title=links[k].childNodes[0].nodeValue;
  33. output=output+' <outline text="'+title+'" title="'+title+'" type="rss" xmlUrl="'+url+'" htmlUrl="'+url+'"/>'+" ";
  34. }
  35. }
  36. return output;
  37. }
  38. var header='<opml version="1.0">'+" "+' <head>'+" "+' <title>Free Academic Podcasts</title>'+" "+' </head>'+" "+' <body>'+" ";
  39. var body='';
  40. names.sort();
  41. var p='Choose from which university you would like to get the podcasts from: 0. All';
  42. for(var l=0;l<names.length;++l){
  43. p=p+' '+(l+1)+'. '+names[l];
  44. }
  45. var reply=prompt(p,"");
  46. var choice=parseInt(reply)-1;
  47. if(choice<0||choice>names.length-1||isNaN(choice)){
  48. for(var l=0;l<names.length;++l){
  49. body=body+' <outline title="'+names[l]+'" text="'+names[l]+'">'+" "+filter(names[l])+' </outline>'+" ";
  50. }
  51. }else{
  52. body=' <outline title="'+names[choice]+'" text="'+names[choice]+'">'+" "+filter(names[choice])+' </outline>'+" ";
  53. }
  54. body=body.replace(/="s/g,'="');
  55. body=body.replace(/&/g,'&amp;');
  56. var footer=' </body>'+" "+'</opml>';
  57. var htmlHeader='<html><head><title>Free Academic Podcasts</title></head><body>';
  58. var htmlFooter='</body></html>';
  59. var opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&/g,'&amp;')).replace(/>/g,'&gt;')).replace(/</g,'&lt;')).replace(/ /g,'<br> '))+htmlFooter;
  60. function popOPML(code){
  61. var gOPML=window.open('','Free Academic Podcasts','top=300,left=200,height=480,width=640');
  62. var tmp=gOPML.document;
  63. tmp.open();
  64. tmp.write(code);
  65. tmp.close();
  66. }
  67. popOPML(opml);
  68.  
  69. /*Resulting Bookmarklet:*/
  70. /*javascript:(function(){var%20isOPML=false;var%20entry=document.getElementById('entry-14040355');var%20ul=entry.getElementsByTagName('ul')[1];var%20links=ul.getElementsByTagName('a');var%20smalls=entry.getElementsByTagName('small');var%20names=[];var%20cond=false;var%20text=url=title='';for(var%20i=0;i&lt;smalls.length;++i){cond=false;text=smalls[i].childNodes[0].nodeValue;for(var%20j=0;j&lt;names.length;++j){if(text==names[j]){cond=true}}if(!cond){names.push(text)}}function%20filter(name){var%20t=output='';for(var%20k=0;k&lt;links.length;++k){t=smalls[k].childNodes[0].nodeValue;if(t==name){url=links[k].href;title=links[k].childNodes[0].nodeValue;output=output+' &lt;outline%20text=%22'+title+'%22%20title=%22'+title+'%22%20type=%22rss%22%20xmlUrl=%22'+url+'%22%20htmlUrl=%22'+url+'%22/&gt;'+%22 %22}}return%20output}var%20header='&lt;opml%20version=%221.0%22&gt;'+%22 %22+' &lt;head&gt;'+%22 %22+' &lt;title&gt;Free%20Academic%20Podcasts&lt;/title&gt;'+%22 %22+' &lt;/head&gt;'+%22 %22+' &lt;body&gt;'+%22 %22;var%20body='';names.sort();var%20p='Choose%20from%20which%20university%20you%20would%20like%20to%20get%20the%20podcasts%20from: %200.%20All';for(var%20l=0;l&lt;names.length;++l){p=p+' %20'+(l+1)+'.%20'+names[l];}var%20reply=prompt(p,%22%22);var%20choice=parseInt(reply)-1;if(choice&lt;0||choice&gt;names.length-1||isNaN(choice)){for(var%20l=0;l&lt;names.length;++l){body=body+' &lt;outline%20title=%22'+names[l]+'%22%20text=%22'+names[l]+'%22&gt;'+%22 %22+filter(names[l])+' &lt;/outline&gt;'+%22 %22;}}else{body=' &lt;outline%20title=%22'+names[choice]+'%22%20text=%22'+names[choice]+'%22&gt;'+%22 %22+filter(names[choice])+' &lt;/outline&gt;'+%22 %22;}var%20tx='='+'%22';body=body.replace(/=%22s/g,tx);body=body.replace(/&amp;/g,'&amp;amp;');var%20footer=' &lt;/body&gt;'+%22 %22+'&lt;/opml&gt;';var%20htmlHeader='&lt;html&gt;&lt;head&gt;&lt;title&gt;Free%20Academic%20Podcasts&lt;/title&gt;&lt;/head&gt;&lt;body&gt;';var%20htmlFooter='&lt;/body&gt;&lt;/html&gt;';var%20opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&amp;/g,'&amp;amp;')).replace(/&gt;/g,'&amp;gt;')).replace(/&lt;/g,'&amp;lt;')).replace(/ /g,'&lt;br&gt; '))+htmlFooter;function%20popOPML(code){var%20gOPML=window.open('','Free%20Academic%20Podcasts','top=300,left=200,height=480,width=640');var%20tmp=gOPML.document;tmp.open();tmp.write(code);tmp.close()}popOPML(opml);})()*/

以上是关于OPML弹出窗口简化播客聚合的主要内容,如果未能解决你的问题,请参考以下文章

Android:将片段和弹出窗口的点击事件中生成的变量传递给活动的方法

TYPESDK手游聚合SDK服务端设计思路与架构之三:流程优化之订单保存与通知

仅在单击某个按钮时显示弹出窗口

是什么使我的WPF弹出窗口与其PlacementTarget的右边缘对齐?

在 recyclerview 适配器类中显示自定义弹出窗口 - Android Java

在片段中使用列表视图