Created
November 20, 2009 12:13
-
-
Save tomohiro/239465 to your computer and use it in GitHub Desktop.
OpenPNE 用の cmd プラグイン
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url2cmd(url) { | |
var static_flickr_com = url.match(/^http:\/\/farm([0-9]+)\.static\.flickr\.com\/([0-9]+)\/([a-z0-9_]+)\.(jpg|jpeg|png|gif)/); | |
if (static_flickr_com) { | |
var pid1 = RegExp.$1; | |
var pid2 = RegExp.$2; | |
var pid3 = RegExp.$3; | |
var pid4 = RegExp.$4; | |
main(pid1, pid2, pid3, pid4); | |
} else { | |
pne_url2a(url); | |
} | |
} | |
function main(pid1, pid2, pid3, pid4) { | |
var html = '<img src="http://farm' + pid1 + '.static.flickr.com/' + pid2 + '/' + pid3 + '.' + pid4 + '">'; | |
document.write(html); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url2cmd(url) { | |
var static_flickr_com = url.match(/^http:\/\/farm([0-9]+)\.static\.flickr\.com\/([0-9]+)\/([a-z0-9_]+)\.(jpg|jpeg|png|gif)/); | |
if (static_flickr_com) { | |
var pid1 = RegExp.$1; | |
var pid2 = RegExp.$2; | |
var pid3 = RegExp.$3; | |
var pid4 = RegExp.$4; | |
main(pid1, pid2, pid3, pid4); | |
} else { | |
pne_url2a(url); | |
} | |
} | |
function main(pid1, pid2, pid3, pid4) { | |
var html = '<img src="http://farm' + pid1 + '.static.flickr.com/' + pid2 + '/' + pid3 + '.' + pid4 + '">'; | |
document.write(html); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url2cmd(url) { | |
var static_flickr_com = url.match(/^http:\/\/farm([0-9]+)\.static\.flickr\.com\/([0-9]+)\/([a-z0-9_]+)\.(jpg|jpeg|png|gif)/); | |
if (static_flickr_com) { | |
var pid1 = RegExp.$1; | |
var pid2 = RegExp.$2; | |
var pid3 = RegExp.$3; | |
var pid4 = RegExp.$4; | |
main(pid1, pid2, pid3, pid4); | |
} else { | |
pne_url2a(url); | |
} | |
} | |
function main(pid1, pid2, pid3, pid4) { | |
var html = '<img src="http://farm' + pid1 + '.static.flickr.com/' + pid2 + '/' + pid3 + '.' + pid4 + '">'; | |
document.write(html); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url2cmd(url) { | |
var static_flickr_com = url.match(/^http:\/\/farm([0-9]+)\.static\.flickr\.com\/([0-9]+)\/([a-z0-9_]+)\.(jpg|jpeg|png|gif)/); | |
if (static_flickr_com) { | |
var pid1 = RegExp.$1; | |
var pid2 = RegExp.$2; | |
var pid3 = RegExp.$3; | |
var pid4 = RegExp.$4; | |
main(pid1, pid2, pid3, pid4); | |
} else { | |
pne_url2a(url); | |
} | |
} | |
function main(pid1, pid2, pid3, pid4) { | |
var html = '<img src="http://farm' + pid1 + '.static.flickr.com/' + pid2 + '/' + pid3 + '.' + pid4 + '">'; | |
document.write(html); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url2cmd(url) { | |
if (!url.match(/^http:\/\/gist\.github\.com\/([0-9]+)#file_(.+$)/) && | |
!url.match(/^http:\/\/gist\.github\.com\/([0-9]+)/)) { | |
pne_url2a(url); | |
return; | |
} | |
var gistId = RegExp.$1; | |
var fileName = RegExp.$2; | |
var width = 425; | |
var height = 350; | |
main(gistId, fileName, width, height); | |
} | |
function main(gistId, fileName, width, height) { | |
if (!gistId.match(/^[0-9]+$/)) { | |
return; | |
} | |
if (!width) width = 0; else width = parseInt(width); | |
if (!height) height = 0; else height = parseInt(height); | |
if (width <= 0 || width > 425) { | |
width = 425; | |
} | |
if (height <= 0 || height > 350) { | |
height = 350; | |
} | |
var gist = ''; | |
if (fileName != null) { | |
gist = gistId + '.js?file=' + fileName; | |
} else { | |
gist = gistId + '.js'; | |
} | |
var html = '<script src="http://gist.github.com/' + gist + '"></script>'; | |
document.write(html); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="./gist.github.com.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<script> | |
url2cmd('http://gist.github.com/226929#file_loto6.scm'); | |
url2cmd('http://gist.github.com/226929'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment