UnionDrawのペンの色を変えるブックマークレット

  • /*
     * @title UnionDrawのペンの色を変えるブックマークレット
     * @description http://unionplatform.com/samples/orbitermicro/UnionDraw/uniondraw.html で実行してみて。
     * @include http://unionplatform.com/samples/orbitermicro/UnionDraw/uniondraw.html
     * @license MIT License
     * @require 
     */
    (function(){
    	var _colorChange = function  (rgb) {
    		// Determine which option was selected
    		var newColor = rgb;
    		// Locally, set the line color to the selected value
    		localLineColor = newColor;
    		// Share selected color with other users
    		msgManager.sendUPC(UPC.SET_CLIENT_ATTR, 
    							orbiter.getClientID(),
    							"",
    							Attributes.COLOR,
    							newColor,
    							roomID,
    							"4");
    		
    		// Scroll the iPhone back to the top-left. 
    		iPhoneToTop();
    	};
    	(function() {
    		var xs = ['00','11','22','33','44','55','66','77','88','99','aa','bb','cc','dd','ee','ff'];
    		var r = xs[Math.random() * xs.length | 0];
    		var g = xs[Math.random() * xs.length | 0];
    		var b = xs[Math.random() * xs.length | 0];
    		var rgb = '#' + r + g + b;
    		document.getElementById('color')[1].innerText = rgb;
    		_colorChange(rgb);
    		setTimeout(arguments.callee, 100) ;
    	})();
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2011/06/02 17:47:37 - 2011-06-02
  2. 2011/06/02 17:44:25 - 2011-06-02
  3. 2011/06/02 17:41:23 - 2011-06-02
  4. 2011/06/02 17:39:32 - 2011-06-02