aboutsummaryrefslogtreecommitdiffstats
path: root/haiku.js
diff options
context:
space:
mode:
authordrry2008-09-22 16:58:33 +0000
committerdrry2008-09-22 16:58:33 +0000
commit5361fb29c592cc5634784f12b34767ecb1cff541 (patch)
tree34820ecc908cc890a3251134c4ff940b0d4cf38a /haiku.js
parent45302a33da999c7beccb5250b6d8d6e0978f5793 (diff)
downloadvimperator-plugins-5361fb29c592cc5634784f12b34767ecb1cff541.tar.bz2
* 正規表現を修正しました。
* ほか。 * 酔っ払いコミット。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@19745 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'haiku.js')
-rw-r--r--haiku.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/haiku.js b/haiku.js
index bc07897..428594e 100644
--- a/haiku.js
+++ b/haiku.js
@@ -103,24 +103,22 @@
liberator.echo(html, true);
}
function convert(str){
- function createHTML(all, extension){
+ function createHTML(url){
var str = '';
- if (/\.(jpe?g|gif|png|bmp)$/.test(extension)){
- str = '<img src="'+all+'"/>';
- } else if (/^http:\/\/www\.youtube\.com\/(?:watch\?v=|v\/)([-\w]+)$/.test(all)){
+ if (/\.(?:jpe?g|gif|png|bmp)$/.test(url)){
+ str = '<img src="'+url+'"/>';
+ } else if (/^http:\/\/www\.youtube\.com\/(?:watch\?v=|v\/)([-\w]+)$/.test(url)){
var url = "http://www.youtube.com/v/" + RegExp.$1;
str = '<a href="#" class="hl-URL">' + url + '</a>\n' +
- '<div><object height="250" width="300">' +
- '<param name="movie" value="' + url + '">' +
- '<param name="wmode" value="transparent">' +
- '<embed src="' + url + '" type="application/x-shockwave-flash" wmode="transparent" height="250" width="300">' +
+ '<div><object height="250" width="300" data="' + url + '" type="application/x-shockwave-flash">' +
+ '<param name="wmode" value="transparent"/>' +
'</object></div>';
} else {
- str = '<a href="#" class="hl-URL">'+all+'</a>';
+ str = '<a href="#" class="hl-URL">'+url+'</a>';
}
return str;
}
- return str.replace(/https?:\/\/[^\/]+?\/([^\s]*)/g, createHTML);
+ return str.replace(/https?:\/\/[-\w!#$%&'()*+,.\/:;=?@~]+/g, createHTML);
}
liberator.commands.addUserCommand(["haiku"], "Change Haiku status",
function(arg, special){
@@ -151,12 +149,12 @@
}
arg = arg.replace(/%URL%/g, liberator.buffer.URL)
- .replace(/%TITLE%/g, liberator.buffer.title);
+ .replace(/%TITLE%/g, liberator.buffer.title);
if (special && arg.match(/^\+\s*(.*)/))
favHaiku(username, password, RegExp.$1)
else
- if (special && arg.match(/^\-\s*(.*)/))
+ if (special && arg.match(/^-\s*(.*)/))
unfavHaiku(username, password, RegExp.$1)
else
if (special || arg.length == 0)