Foto2Haiku
@@ -1,22 +1,27 @@
/*
- * @title fotolife_bookmarklet_v3-2
- * @description 標準ブラウザ向けfotolife記法表示ブックマークレット(標準版はてなハイクに行きます)
+ * @title Foto2Haiku
+ * @description Post image to HaikuJP with Fotolife Syntax (Forked from fotolife_bookmarklet_v3-2 by Tensor)
* @include http://f.hatena.ne.jp/*
+ * @include http://f.hatena.com/*
* @license MIT License
+ * @see http://let.hatelabo.jp/Tensor/let/gYC-xeX1pt_0Xg (Fork of)
+ * @see http://d.hatena.ne.jp/Tensor/20120508/1336452125
*/
+// # Changes
+// - allow Hatena World (.com)
+// - window.open() -> location.href :for popup-blocker
+// If you non support old browsers (ex. IE < 8), more better use of document.QuerySelector('#breadcrumbs input[value]')
+// https://developer.mozilla.org/Ja/DOM/Document.querySelector
-javascript:(
- function(){
- var lc=location.href;
- if(lc.match('http://f.hatena.ne.jp')){
- var ta=document.getElementById('breadcrumbs');
- var tb=ta.getElementsByTagName('input');
- if(tb.length){
- var cp=window.prompt('OKではてなハイクに貼り付けます',tb[0].value);
- if(cp!=null){
- window.open('http://h.hatena.ne.jp/?_charset_=utf-8&body='+tb[0].value);
- }
- }
- }
- }
-)();
+(function () {
+ if (typeof Ten !== 'object') return;
+
+ if (/^http:\/\/f\.hatena\.(?:ne\.jp|com)\/[\w-]+\/\d{14}/.test(location.href)) {
+ var fotoSyntax = Ten.querySelector('#breadcrumbs input');
+ if (!fotoSyntax || !fotoSyntax.value) return;
+
+ if (window.prompt('Sure?', fotoSyntax.value)) {
+ location.href = 'http://h.hatena.ne.jp/?_charset_=utf-8&body=' + fotoSyntax.value;
+ }
+ }
+})();
/*
* @title Foto2Haiku
* @description Post image to HaikuJP with Fotolife Syntax (Forked from fotolife_bookmarklet_v3-2 by Tensor)
* @include http://f.hatena.ne.jp/*
* @include http://f.hatena.com/*
* @license MIT License
* @see http://let.hatelabo.jp/Tensor/let/gYC-xeX1pt_0Xg (Fork of)
* @see http://d.hatena.ne.jp/Tensor/20120508/1336452125
*/
// # Changes
// - allow Hatena World (.com)
// - window.open() -> location.href :for popup-blocker
// If you non support old browsers (ex. IE < 8), more better use of document.QuerySelector('#breadcrumbs input[value]')
// https://developer.mozilla.org/Ja/DOM/Document.querySelector
(function () {
if (typeof Ten !== 'object') return;
if (/^http:\/\/f\.hatena\.(?:ne\.jp|com)\/[\w-]+\/\d{14}/.test(location.href)) {
var fotoSyntax = Ten.querySelector('#breadcrumbs input');
if (!fotoSyntax || !fotoSyntax.value) return;
if (window.prompt('Sure?', fotoSyntax.value)) {
location.href = 'http://h.hatena.ne.jp/?_charset_=utf-8&body=' + fotoSyntax.value;
}
}
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。