q1404713359
by
noromanba
2014-07-08 [2014/07/08 01:43:03]
(Forked from
q1404713359 by
a-kuma3)
q1404713359 over the mixed-content blocking (and CSP)
@@ -1,35 +1,28 @@
/*
* @title q1404713359
- * @description q1404713359
+ * @description q1404713359 over the mixedcontent (and CSP)
* @include http://*
+ * @include https://*
+ * @contributor a-kuma3 http://let.hatelabo.jp/a-kuma3/let/hLHV4fn3yp8e
* @license MIT License
- * @require
+ * @javascript_url
*/
+
+// http://q.hatena.ne.jp/1404713359
(function () {
- var lc = location.href;
- if (lc.match('https://www.facebook.com/')) {
+ var lc = location.hostname;
+
+ if (lc.match('www.facebook.com')) {
var list = document.getElementsByTagName("abbr");
for (var i = 0 ; i < list.length ; ++i) {
var e = list[i];
-//console.log("F : " + i + " : " + e.innerHTML + " --> " + e.title);
- e.innerHTML = e.title;
+ e.textContent = e.title;
}
- } else if (lc.match('https://twitter.com/')) {
- var list = document.getElementsByTagName("span");
- for (var i = 0 ; i < list.length ; ++i) {
- var e = list[i];
- if (e.className.indexOf("js-short-timestamp") == -1) {
- continue;
- }
- var title = e.parentNode.title;
- if (title == "") {
- title = e.parentNode.getAttribute("data-original-title");
- }
+ } else if (lc.match('twitter.com')) {
+ Array.prototype.forEach.call(document.querySelectorAll("span.js-short-timestamp"), function (e) {
+ var title = e.parentNode.title || e.parentNode.getAttribute("data-original-title");
title = title.replace(/(.*) - (.*)/, "$2 $1");
-//console.log("T : " + i + " : " + e.innerHTML + " --> " + title);
- e.innerHTML = title;
- }
+ e.textContent = title;
+ });
}
-})();
-
-
+})();
(function () {
var lc = location.hostname;
if (lc.match('www.facebook.com')) {
var list = document.getElementsByTagName("abbr");
for (var i = 0 ; i < list.length ; ++i) {
var e = list[i];
e.textContent = e.title;
}
} else if (lc.match('twitter.com')) {
Array.prototype.forEach.call(document.querySelectorAll("span.js-short-timestamp"), function (e) {
var title = e.parentNode.title || e.parentNode.getAttribute("data-original-title");
title = title.replace(/(.*) - (.*)/, "$2 $1");
e.textContent = title;
});
}
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。