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).
/* 'Get Podcasts' * if isOPML is false, it pops up an escaped version in HTML. * if isOPML is true, it pops up an OPML version. * Either way, you need to copy and save the results as a file with an .opml extension * You can then add it to your Aggregator of choice: */ var isOPML=false; var entry=document.getElementById('entry-14040355'); var ul=entry.getElementsByTagName('ul')[1]; var links=ul.getElementsByTagName('a'); var smalls=entry.getElementsByTagName('small'); var names=[];var cond=false;var text=url=title=""; for(var i=0;i<smalls.length;++i){ cond=false;text=smalls[i].childNodes[0].nodeValue; for(var j=0;j<names.length;++j){ if(text==names[j]){ cond=true; } } if(!cond){ names.push(text); } } //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"]; function filter(name){ var t=output=""; for(var k=0;k<links.length;++k){ t=smalls[k].childNodes[0].nodeValue; if(t==name){ url=links[k].href; title=links[k].childNodes[0].nodeValue; output=output+' <outline text="'+title+'" title="'+title+'" type="rss" xmlUrl="'+url+'" htmlUrl="'+url+'"/>'+" "; } } return output; } var header='<opml version="1.0">'+" "+' <head>'+" "+' <title>Free Academic Podcasts</title>'+" "+' </head>'+" "+' <body>'+" "; var body=''; names.sort(); var p='Choose from which university you would like to get the podcasts from: 0. All'; for(var l=0;l<names.length;++l){ p=p+' '+(l+1)+'. '+names[l]; } var reply=prompt(p,""); var choice=parseInt(reply)-1; if(choice<0||choice>names.length-1||isNaN(choice)){ for(var l=0;l<names.length;++l){ body=body+' <outline title="'+names[l]+'" text="'+names[l]+'">'+" "+filter(names[l])+' </outline>'+" "; } }else{ body=' <outline title="'+names[choice]+'" text="'+names[choice]+'">'+" "+filter(names[choice])+' </outline>'+" "; } body=body.replace(/="s/g,'="'); body=body.replace(/&/g,'&'); var footer=' </body>'+" "+'</opml>'; var htmlHeader='<html><head><title>Free Academic Podcasts</title></head><body>'; var htmlFooter='</body></html>'; var opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&/g,'&')).replace(/>/g,'>')).replace(/</g,'<')).replace(/ /g,'<br> '))+htmlFooter; function popOPML(code){ var gOPML=window.open('','Free Academic Podcasts','top=300,left=200,height=480,width=640'); var tmp=gOPML.document; tmp.open(); tmp.write(code); tmp.close(); } popOPML(opml); /*Resulting Bookmarklet:*/ /*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<smalls.length;++i){cond=false;text=smalls[i].childNodes[0].nodeValue;for(var%20j=0;j<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<links.length;++k){t=smalls[k].childNodes[0].nodeValue;if(t==name){url=links[k].href;title=links[k].childNodes[0].nodeValue;output=output+' <outline%20text=%22'+title+'%22%20title=%22'+title+'%22%20type=%22rss%22%20xmlUrl=%22'+url+'%22%20htmlUrl=%22'+url+'%22/>'+%22 %22}}return%20output}var%20header='<opml%20version=%221.0%22>'+%22 %22+' <head>'+%22 %22+' <title>Free%20Academic%20Podcasts</title>'+%22 %22+' </head>'+%22 %22+' <body>'+%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<names.length;++l){p=p+' %20'+(l+1)+'.%20'+names[l];}var%20reply=prompt(p,%22%22);var%20choice=parseInt(reply)-1;if(choice<0||choice>names.length-1||isNaN(choice)){for(var%20l=0;l<names.length;++l){body=body+' <outline%20title=%22'+names[l]+'%22%20text=%22'+names[l]+'%22>'+%22 %22+filter(names[l])+' </outline>'+%22 %22;}}else{body=' <outline%20title=%22'+names[choice]+'%22%20text=%22'+names[choice]+'%22>'+%22 %22+filter(names[choice])+' </outline>'+%22 %22;}var%20tx='='+'%22';body=body.replace(/=%22s/g,tx);body=body.replace(/&/g,'&amp;');var%20footer=' </body>'+%22 %22+'</opml>';var%20htmlHeader='<html><head><title>Free%20Academic%20Podcasts</title></head><body>';var%20htmlFooter='</body></html>';var%20opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&/g,'&amp;')).replace(/>/g,'&gt;')).replace(/</g,'&lt;')).replace(/ /g,'<br> '))+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的右边缘对齐?