<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
var x=new Array();
var n;
function sample(){
n=1;
paint();
$("#memo").click(function () {
n=n+1;
if(n>5)n=1;
paint(n);
});
}
function paint(){
google.script.run
.withSuccessHandler(function(x) {
str="<h1>"+x[0]+"</h1>";
for(s=1;s<x.length;s++){
str=str+"<h2>"+x[s]+"</h2>";
}
$("#memo").html(str);
})
.withFailureHandler(function(msg) {})
.play(n)
}
</script>
function doGet(e) {
var template = HtmlService.createTemplateFromFile('index');
return template.evaluate()
.setTitle('本')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function play(n){
var urlx="http://www.coara.or.jp/~cheerkey/mari/mari"+n+".html";
str="";
try {
var res = UrlFetchApp.fetch(urlx);
str=res.getContentText("SJIS");
} catch (e) { Logger.log("Fail");}
for(s=1;s<400;s++){
str=str.replace("<BR>","〇");
}
str=clean_str(str);
var x=str.split("〇");
return x;
}
function clean_str(str){
sp=str;
for(kk=1;kk<250;kk++){
sp=fresh(sp);
}
return sp;
}
function fresh(strstr){
strstr=""+strstr;
p1=strstr.indexOf("<")
p2=-1;
if(p1>-1)p2=strstr.indexOf(">",p1)
k="";
if(p2>-1)k=strstr.substring(p1,p2)+">";
strxp=strstr.replace(k,"");
return strxp;
}
最終更新:2017年08月14日 09:03