Last active
August 29, 2015 13:56
-
-
Save poochin/8844141 to your computer and use it in GitHub Desktop.
my Bookmark let
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
/** | |
* 一定時間後に alert で強制的にそのタブをアクティブにさせます。 | |
* | |
* 何かしらのページでは一定時間後に特定の操作を行いたいという場合があると思います。 | |
* そのような場合に有用です。 | |
*/ | |
javascript: void (function () { | |
var str, l, m, s, t; | |
str = prompt('input time of alert mm:ss(or only ss)'); | |
l = str.split(':'); | |
if (l.length >= 2) { | |
m = parseInt(l[0]); | |
s = parseInt(l[1]); | |
} else { | |
m = 0; | |
s = parseInt(l[0]); | |
} | |
t = m * 60 + s; | |
setTimeout(alert.bind(null, ["it's time"]), t * 1000); | |
console.log(['set time', m, 'minute', s, 'second'].join(' ')); | |
})(); | |
/* */ |
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
/** | |
* 現在開いているページのうち input 要素の disable 属性が true になっているものを false にします。 | |
*/ | |
javascript: void $('input').map(function () { | |
this.disabled = false; | |
}); | |
/* */ |
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
/** | |
* 現在開いているページの a 要素が jpg, gif, png を指している場合には、 | |
* その a 要素の中にその画像の img 要素を追加します。 | |
*/ | |
javascript: void Array.apply(0, document.querySelectorAll('a')).filter(function (elm) { | |
return elm.href && elm.href.match(/(jpe?g|gif|png)$/i); | |
}).map(function (elm) { | |
var i = elm.appendChild(document.createElement('img')); | |
i.src = elm.href; | |
}); | |
/* */ |
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
/** | |
* 現在開いているページに jpg, gif, png へのテキストがあった場合に img 要素を追加します。 | |
* document.body の html を丸々入れ替えているためレイアウトは崩れます。 | |
*/ | |
javascript: void(document.body.innerHTML = document.body.innerHTML.replace(/(h?ttps?:\/\/(\s|\S)*?\.(?:jpe?g|png|gif))/ig, "$1<img src='$1'>")); | |
/* */ |
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
Array.apply(0, $$('img[onmousedown^=toggle_pin]')).map(function(el){return el.onmousedown();}); | |
// |
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 にして出力します。 | |
* | |
* 選択範囲が短い場合は alert の出力で十分でしょう。 | |
* chrome では一定以上の長さになると尻切れになるため js console に出力しています。 | |
*/ | |
javascript: void (function () { | |
var d, f = window.getSelection().getRangeAt().cloneContents(); | |
(d = document.createElement('div')).appendChild(f); | |
alert(d.innerHTML); | |
console.log(d.innerHTML); | |
})(); | |
/* */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment