[URL:title=escaped]
by
noromanba
2018-06-05 [2018/06/05 22:01:36]
prompt escaped title with Hatena Syntax
@@ -8,11 +8,16 @@
*/
// # NOTE
// Hatena::Diary unhandle square brackets '[', ']' within http syntax with title
-// e.g. [http://include.square.brackets.in/title:title] or [http://example.com:title=this is [example] domain]
+// e.g.
+// - [http://include.square.brackets.in/title:title]
+// - [http://example.com:title=this is [example] domain]
-// Hatena::Diary use euc-JP, i.e. unwork entities. oops..
-//var escaped = document.title.replace(/\[/, '[').replace(/\]/, ']');
-var escaped = encodeURI(document.title);
-var syntax ='[' + location.href + ':title=' + escaped + ']';
+(function () {
+ // H::D use euc-JP, i.e. unwork entities. oops..
+ // Hatena::Group and Hatena Blog use UTF-8, works well
+ //var escaped = document.title.replace(/\[/, '[').replace(/\]/, ']');
+ var escaped = encodeURI(document.title);
+ var syntax ='[' + location.href + ':title=' + escaped + ']';
-prompt('Copy Me', syntax);
+ prompt('Copy Me', syntax);
+})();
(function () {
var escaped = encodeURI(document.title);
var syntax ='[' + location.href + ':title=' + escaped + ']';
prompt('Copy Me', syntax);
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。