// ==UserScript== // @name WebOffice Login for Google Chrome // @version 0.0.2 // @namespace https://gist.github.com/3736189 // @description Makes WebOffice to be worked on Google Chrome. // @match http://hr.weboffice.co.kr/main/jsp/login.jsp // @match http://hr.weboffice.co.kr/tam/tm_attend/tm_attend* // @copyright 2012, Heungsub Lee // @license Public Domain // ==/UserScript== var fn = function() { // patch XSheet parser var _makeXSheetWithXmlText = window.makeXSheetWithXmlText; window.makeXSheetWithXmlText = function(xmlText, mode) { var try_these = Try.these; Try.these = function() { var xdom = {}; xdom.loadXML = function(xml) { this.__proto__ = (new DOMParser()).parseFromString(xml, 'text/xml'); window.xdom = this; if (this.documentElement.nodeName == 'parsererror') { this.parseError = {errorCode: 1}; } else { this.parseError = {errorCode: 0}; } }; return xdom; }; var result = _makeXSheetWithXmlText(xmlText, mode); Try.these = try_these; return result; }; // methods for XmlSheet, XMLDocument XmlSheet.prototype.EtcData = function(key) { var etcs = this.xdom.documentElement.getElementsByTagName('ETC'); var result = null; $A(etcs).each(function(e) { if (e.getAttribute('KEY') == key) { result = e.childNodes[0].data; return false; } }); return result; }; XMLDocument.prototype.selectNodes = function(xpath) { var result = document.evaluate(xpath, this.documentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); var nodes = []; for (var i = 0; i < result.snapshotLength; ++i) { nodes.push(result.snapshotItem(i)); } return nodes; }; XMLDocument.prototype.selectSingleNode = function(xpath) { var nodes = this.selectNodes(xpath); if (nodes.length) { return nodes[0]; } return null; }; // run InitPage again document.forms[0].document = document.forms[0]; InitPage(); }; var e = document.createElement('script'); e.innerHTML = '(' + fn.toString() + ')();'; var scripts = document.head.getElementsByTagName('script'); var target = scripts[scripts.length - 1]; target.parentNode.insertBefore(e, target);