HTML

CSS

JavaScript

Wait 3 seconds and jump to the root page:

1
2
3
4
5
<script type="text/javascript">
  setTimeout(function () {
    window.location.replace("/");
  }, 3000);
</script>

Google Analytics Tracking Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '[Tracking ID]', 'auto');
  ga('send', 'pageview');

</script>

Submit html form without redirection:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
function SubForm () {
  $.ajax({
    url: '/post',
    type: 'post',
    data:$('#myForm').serialize(),
    success:function(){
      console.log("worked");
    }
  });
}

JS Bookmarklet

Create Amazon Associates Link for a Product on Amazon.com:

1
2
3
4
5
6
7
8
9
javascript:(function() {
  var loc = window.location;
  if (loc.hostname === "www.amazon.com") {
    loc.href = loc.href.split("?")[0] + "?tag=yuewume-20";
    console.log("Bingo, you are ready to go.")
  } else {
    console.log("Sorry, only works on [Amazon.com].")
  }
})()

Load English/Chinese Version of Current Wiki Page:

1
2
3
4
5
javascript:(function() {
  window.location.href = document
    .getElementsByClassName('interlanguage-link interwiki-en')[0]
    .getElementsByTagName('a')[0].href;
})()

Open All Entries in Pocket:

1
2
3
4
5
6
javascript:(function() {
  var links = document.getElementsByClassName('item');
  for (var i = 0; i < links.length; i++) {
      window.open(links[i].getElementsByClassName('original_url')[0].href, '_blank');
  }
})();