gaga booon

    @@ -10,8 +10,8 @@ gaga.src = "http://monpy.moo.jp/trash_img/gaga.png"; var wrp = document.createElement('div'); wrp.style.position = "absolute"; -wrp.style.top = '-283px'; -wrp.style.left = '50%'; +wrp.style.top = '-1000px'; +wrp.style.left = '0px'; wrp.appendChild(gaga); var position = -283; @@ -20,20 +20,25 @@ var objBody = document.getElementsByTagName("body").item(0); objBody.appendChild(wrp); -setTimeout(setPosition,200); -function setPosition(){ -if(flag){ -position++; -}else{ -position--; -} -if(position > 0){ -flag = false; +var mX = 0; +var mY = 0; +var toY = 0; +var toX = 0; +function MouseMoveFunc(e){ +mX = e.clientX; +mY = e.clientY; } -if(position < -283){ -flag = true; -wrp.style.left = Math.random()*100+'%'; + +document.addEventListener("mousemove" , MouseMoveFunc); + + +setTimeout(calc,200); +function calc(){ + toX = mX; + toY = mY; + setPosition(); } -wrp.style.top = position+'px'; -setTimeout(setPosition,10); +function setPosition(){ +wrp.style.top = toY+'px'; +wrp.style.left = toX+'px'; }
  • /*
     * @title gaga booon
     * @description my bookmarklet
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    var gaga = document.createElement('img');
    gaga.src =  "http://monpy.moo.jp/trash_img/gaga.png";
    var wrp = document.createElement('div');
    wrp.style.position = "absolute";
    wrp.style.top = '-1000px';
    wrp.style.left = '0px';
    wrp.appendChild(gaga);
    
    var position = -283;
    var flag = true;
    
    var objBody = document.getElementsByTagName("body").item(0);
    objBody.appendChild(wrp);
    
    var mX = 0;
    var mY = 0;
    var toY = 0;
    var toX = 0;
    function MouseMoveFunc(e){
    mX = e.clientX;
    mY = e.clientY;
    }
    
    document.addEventListener("mousemove" , MouseMoveFunc);
    
    
    setTimeout(calc,200);
    function calc(){
      toX = mX;
      toY = mY;
      setPosition();
    }
    function setPosition(){
    wrp.style.top = toY+'px';
    wrp.style.left = toX+'px';
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2013/11/15 00:36:36 - 2013-11-15
  2. 2013/11/15 00:13:46 - 2013-11-15
  3. 2013/11/15 00:06:53 - 2013-11-15
  4. 2013/11/14 23:38:40 - 2013-11-14
  5. 2013/11/14 23:37:52 - 2013-11-14
  6. 2013/11/14 16:37:14 - 2013-11-14
  7. 2013/11/14 16:36:12 - 2013-11-14
  8. 2013/11/14 16:35:28 - 2013-11-14
  9. 2013/11/14 16:34:08 - 2013-11-14
  10. 2013/11/14 16:33:07 - 2013-11-14
  11. 2013/11/14 16:32:37 - 2013-11-14
  12. 2013/11/14 16:31:52 - 2013-11-14
  13. 2013/11/14 16:22:00 - 2013-11-14
  14. 2013/11/14 16:21:32 - 2013-11-14
  15. 2013/11/14 16:20:45 - 2013-11-14
  16. 2013/11/14 16:17:51 - 2013-11-14