Open2

bookmarklet

counterintuitivecounterintuitive

不要な改行を減らすブックマークレット
Teamsのコメントをコピーして他所へ貼り付ける際とか

data:text/html;charset=utf-8,%0D%0A<!DOCTYPE html>%0D%0A<html lang="ja">%0D%0A<head>%0D%0A<meta charset="UTF-8">%0D%0A<title>Converter</title>%0D%0A</head><body>%0D%0A%0D%0A<textarea name="source" id="_source" style="width:48%;min-height:400px;"></textarea>%0D%0A<textarea name="converted" id="_converted" style="width:48%;min-height:400px;"></textarea>%0D%0A%0D%0A%0D%0A<!--%0D%0A<label>TextArea<textarea name="example" id="_textArea" cols="50%" rows="10"></textarea></label>%0D%0A%0D%0A<label>Text<input type="text" id="_text"></label>%0D%0A</p>%0D%0A%0D%0A<p>%0D%0A<label>Option%EF%BC%9A%0D%0A    <select id="_option">%0D%0A    <option value="">Select</option>%0D%0A    <option value="_opt1_">Option 1</option>%0D%0A    <option value="_opt2_">Option 2</option>%0D%0A    <option value="_opt3_">Option 3</option>%0D%0A    </select>%0D%0A</label>%0D%0A</p>%0D%0A%0D%0A<p>%0D%0A<input type="radio" id="_radio1" name="div" value="_radio1_" checked>%0D%0A<label for="_radio1">Radio 1</label><br>%0D%0A<input type="radio" id="_radio2" name="div" value="_radio2_" checked>%0D%0A<label for="_radio2">Radio 2</label><br>%0D%0A<input type="radio" id="_radio3" name="div" value="_radio3_" checked>%0D%0A<label for="_radio3">Radio 3</label><br>%0D%0A</p>%0D%0A-->%0D%0A%0D%0A<script>%0D%0Afunction inputChange(event){%0D%0A    let v = event.currentTarget.value;%0D%0A    let vn = v.replace(/(\r\n){2,}|\r{2,}|\n{2,}/g, '\n');%0D%0A    console.log(v);%0D%0A    document.getElementById('_converted').value = vn;%0D%0A}%0D%0A%0D%0Alet source_ = document.getElementById('_source');%0D%0Asource_.addEventListener('input', inputChange);%0D%0A%0D%0A<!--%0D%0Alet textArea_ = document.getElementById('_textArea');%0D%0AtextArea_.addEventListener('input', inputChange);%0D%0A%0D%0Alet text_ = document.getElementById('_text');%0D%0Atext_.addEventListener('input', inputChange);%0D%0A%0D%0Alet option_ = document.getElementById('_option');%0D%0Aoption_.addEventListener('input', inputChange);%0D%0A%0D%0Alet radio1_ = document.getElementById('_radio1');%0D%0Aradio1_.addEventListener('input', inputChange);%0D%0Alet radio2_ = document.getElementById('_radio2');%0D%0Aradio2_.addEventListener('input', inputChange);%0D%0Alet radio3_ = document.getElementById('_radio3');%0D%0Aradio3_.addEventListener('input', inputChange);%0D%0A-->%0D%0A%0D%0A</script>%0D%0A%0D%0A</body>%0D%0A</html>
counterintuitivecounterintuitive

Google検索の検索期間を切り替える

javascript:(function()%7Bjavascript%3A(function()%7B  if(!%2Fgoogle%2F.test(location.hostname)) return%3B  var u %3D location.href%2C      regex %3D %2F(%5B%3F%26%5D)tbs%3Dqdr%3A(y%7Cm%7Cw%7Cd%7Ch)(%26%7C%24)%2F%2C      m %3D u.match(regex)%2C      map %3D %7By%3A"m"%2C m%3A"w"%2C w%3A"d"%2C d%3A"h"%2C h%3Anull%7D%3B  if(!m)%7B    location.href %3D u %2B (%2F%5C%3F%2F.test(u) %3F "%26" %3A "%3F") %2B "tbs%3Dqdr%3Ay"%3B  %7D else %7B    var cur %3D m%5B2%5D%2C nxt %3D map%5Bcur%5D%3B    if(nxt !%3D%3D null)%7B      location.href %3D u.replace(regex%2C m%5B1%5D %2B "tbs%3Dqdr%3A" %2B nxt %2B (m%5B3%5D%7C%7C""))%3B    %7D else %7B      var newU %3D u.replace(regex%2C function(match%2C p1%2C p2%2C p3)%7B        return p1 %3D%3D%3D %2527%3F%2527 %3F (p3 %3F %2527%3F%2527 %3A %2527%2527) %3A %2527%2527%3B      %7D)%3B      newU %3D newU.replace(%2F%5B%3F%26%5D%24%2F%2C %2527%2527)%3B      location.href %3D newU%3B    %7D  %7D%7D)()%3B%7D)()%3B

検索結果が表示されている状態で実行する。
実行するごとに期間が「年」→「月」→「週」→「日」→(無し)と切り替わる
google以外のURLには反応しない