Skip to content

Instantly share code, notes, and snippets.

@tpai
Last active August 29, 2015 14:08
Show Gist options
  • Save tpai/eaaa39a9f078239bafdf to your computer and use it in GitHub Desktop.
Save tpai/eaaa39a9f078239bafdf to your computer and use it in GitHub Desktop.
eyny-image-packer
if (location.hostname.search("eyny.com") != -1) {
var data = "";
var img_arr = new Array;
img_arr = document.getElementsByClassName("pcb")[0].getElementsByTagName("img");
var view = prompt("[1]HTML(網頁)[2]Links(連結)", "");
for (var i = 0; i < img_arr.length; i++) {
if (view == 1) {
data += "<img src='" + img_arr[i].getAttribute("src") + "' width='" + img_arr[i].getAttribute("width") + "' /><br />\n"
} else if (view == 2) {
data += img_arr[i].getAttribute("src") + "\r\n"
}
}
if (view == 1) mimeType = "text/html";
else if (view == 2) mimeType = "text/plain";
window.location.href = "data:" + mimeType + ";charset=utf-8," + encodeURIComponent(data)
} else {
alert("eyny.com")
}
javascript:if(location.hostname.search("eyny.com")!=-1){var data="";var img_arr=new Array;img_arr=document.getElementsByClassName("pcb")[0].getElementsByTagName("img");var view=prompt("[1]HTML(網頁)[2]Links(連結)","");for(var i=0;i<img_arr.length;i++){if(view==1){data+="<img src='"+img_arr[i].getAttribute("src")+"' width='"+img_arr[i].getAttribute("width")+"' /><br />\n"}else if(view==2){data+=img_arr[i].getAttribute("src")+"\r\n"}}if(view==1)mimeType="text/html";else if(view==2)mimeType="text/plain";window.location.href="data:"+mimeType+";charset=utf-8,"+encodeURIComponent(data)}else{alert("eyny.com")}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment