/* * Copyright (c) 2010 Otchy * This source file is subject to the MIT license. * https://www.otchy.net */ var TwitAPI = function(base, app) { // common values this.version = '0.1.2'; this.base = !base ? 'http://taj-proxy.appspot.com' : base; this.app = !app ? 'twit-api-js' : app; this.w = window; this.d = document; this.cnt = 0; this.tk = false; this.ok = false; this.ag = false; this.ge = function(id){return this.d.getElementById(id);}; this.ce = function(el){return this.d.createElement(el);}; this.ac = function(e){this.d.body.appendChild(e);}; this.rc = function(e){try{this.d.body.removeChild(e);}catch(e){}}; this.fn = function(){return 'TwitApiFunc'+(++this.cnt);}; // set styles var style = this.ce('style'); this.d.getElementsByTagName('head')[0].appendChild(style); var ss = this.d.styleSheets[this.d.styleSheets.length - 1]; ss.add = (function(){ if (!!ss.addRule) { return ss.addRule; } else if (!!ss.insertRule) { return function(selector, style) { ss.insertRule(selector + '{' + style + '}', ss.cssRules.length); } } })(); var body = /BackCompat/i.test(this.d.compatMode) ? this.d.body : this.d.documentElement; ss.add('div.twit-api-js', 'margin: 0;' + 'padding: 0;' + 'border: 0;' + 'color: #000;' + 'font-size: 10pt;' ); ss.add('div.twit-api-js button', 'font-size: 10pt;' + 'color: #fff;' + 'border-radius: 10px;' + '-moz-border-radius: 10px;' + '-webkit-border-radius: 10px;' + '-o-border-radius: 10px;' + '-ms-border-radius: 10px;' ); ss.add('#twit-api-js-bg', 'position: absolute;' + 'top: 0;' + 'left: 0;' + 'width: ' + body.scrollWidth + 'px;' + 'height: ' + body.scrollHeight +'px;' + 'background: #ccc;' + 'opacity: 0.5;' + 'filter: alpha(opacity=50);' + 'z-index: 99998;' + 'display: none;' ); ss.add('#twit-api-js-pop', 'position: fixed;' + '_position: absolute;' + 'top: 200px;' + 'left: 50%;' + 'width: 500px;' + 'margin: -80px 0 0 -250px;' + 'z-index: 99999;' + 'display: none;' ); ss.add('#twit-api-js-cont', 'padding: 10px;' + 'border: solid 5px #3aa4c8;' + 'border-radius: 10px;' + '-moz-border-radius: 10px;' + '-webkit-border-radius: 10px;' + '-o-border-radius: 10px;' + '-ms-border-radius: 10px;' + 'background: #9ae4e8;' + 'box-shadow: 5px 5px 10px #333;' + '-moz-box-shadow: 5px 5px 10px #333;' + '-webkit-box-shadow: 5px 5px 10px #333;' + '-o-box-shadow: 5px 5px 10px #333;' + '-ms-box-shadow: 5px 5px 10px #333;' + 'filter:progid:DXImageTransform.Microsoft.Shadow(Color=#333333,Strength=10,Direction=135);zoom:1;' ); ss.add('#twit-api-js-div1', 'text-align: right;' ); ss.add('#twit-api-js-cancel', 'background: #f66;' ); ss.add('#twit-api-js-div4', 'text-align: center;' ); ss.add('#twit-api-js-auth', 'padding: 2px 30px;' + 'background: #3aa4c8;' ); ss.add('#twit-api-js-div5', 'margin-top: 20px;' ); ss.add('#twit-api-js-div6', 'text-align: center;' ); ss.add('#twit-api-js-continue', 'padding: 2px 30px;' + 'background: #3aa4c8;' ); // append html var bg = this.ce('div'); bg.className = 'twit-api-js'; bg.id = 'twit-api-js-bg'; this.ac(bg); var pop = this.ce('div'); pop.className = 'twit-api-js'; pop.id = 'twit-api-js-pop'; pop.innerHTML = '