rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
xmla._requestError(options) | xmla._requestError(options); | request: function(options){ var xmla = this; if (this.response){ this.response.close(); } this.response = null; this.responseText = null; this.responseXml = null; options.url = _isUndefined(options.url)? this.options.url : options.url; if (_isUndefined(options.url)){ ex = Xmla.Exception._newError( "MISSING_URL", "Xmla.request", options ); ex._throw(); } options.properties = _applyProperties(options.properties, this.options.properties, false); options.restrictions = _applyProperties(options.restrictions, this.options.restrictions, false); options.async = _isUndefined(options.async) ? this.options.async : options.async; options.requestTimeout = _isUndefined(options.requestTimeout) ? this.options.requestTimeout : options.requestTimeout; var soapMessage = _getXmlaSoapMessage(options); this.soapMessage = soapMessage; var myXhr; var ajaxOptions = { async: options.async, timeout: options.requestTimeout, data: soapMessage, error: function(exception){ options.exception = exception; xmla._requestError(options) }, complete: function(xhr){ options.xhr = xhr; xmla._requestSuccess(options); }, url: options.url }; if (options.username){ ajaxOptions.username = options.username; } if (options.password){ ajaxOptions.password = options.password; } if (this._fireEvent(Xmla.EVENT_REQUEST, options, true) && ( (options.method == Xmla.METHOD_DISCOVER && this._fireEvent(Xmla.EVENT_DISCOVER, options)) || (options.method == Xmla.METHOD_EXECUTE && this._fireEvent(Xmla.EVENT_EXECUTE, options)) ) ) { myXhr = _ajax(ajaxOptions); } return this.response; }, |
options.exception = exeception; | options.exception = exception; | request: function(options){ var xmla = this; if (this.response){ this.response.close(); } this.response = null; this.responseText = null; this.responseXml = null; options.url = _isUndefined(options.url)? this.options.url : options.url; if (_isUndefined(options.url)){ ex = Xmla.Exception._newError( "MISSING_URL", "Xmla.request", options ); ex._throw(); } options.properties = _applyProperties(options.properties, this.options.properties, false); options.restrictions = _applyProperties(options.restrictions, this.options.restrictions, false); options.async = _isUndefined(options.async) ? this.options.async : options.async; options.requestTimeout = _isUndefined(options.requestTimeout) ? this.options.requestTimeout : options.requestTimeout; var soapMessage = _getXmlaSoapMessage(options); this.soapMessage = soapMessage; var myXhr; var ajaxOptions = { async: options.async, timeout: options.requestTimeout, data: soapMessage, error: function(exception){ options.exception = exeception; xmla._requestError(options) }, complete: function(xhr){ options.xhr = xhr; xmla._requestSuccess(options); }, url: options.url }; if (options.username){ ajaxOptions.username = options.username; } if (options.password){ ajaxOptions.password = options.password; } if (this._fireEvent(Xmla.EVENT_REQUEST, options, true) && ( (options.method == Xmla.METHOD_DISCOVER && this._fireEvent(Xmla.EVENT_DISCOVER, options)) || (options.method == Xmla.METHOD_EXECUTE && this._fireEvent(Xmla.EVENT_EXECUTE, options)) ) ) { myXhr = _ajax(ajaxOptions); } return this.response; }, |
try | this.callbacks[requestId] = callback; var data = JSON.stringify({ "params": params, "method": method, "id": requestId }); if (log.logSensitiveData) log.debug("Sending a JSON-RPC request: " + data); else log.debug("Sending a JSON-RPC request"); var writeResult = session.writeData(data); if (writeResult <=0) | this.request = function(session, method, params, callback, requestId) { if (requestId == undefined || requestId == null || requestId < 0) throw("JSON-RPC communciation requested with no requestID provided."); try { log.info("TITLE: " + params[0].title); } catch (e) {} this.callbacks[requestId] = callback; log.info("Processing a JSON-RPC object..." + method + ":" + params); //log.info("Processing a JSON-RPC object..." + method + ":" + params); var data = JSON.stringify({ "params": "1" }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": 2 }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify( params ); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": params, "method": method, "id": requestId }); log.info("Processed a JSON-RPC object: " + data); session.writeData(data); } |
log.info("TITLE: " + params[0].title); } catch (e) {} this.callbacks[requestId] = callback; log.info("Processing a JSON-RPC object..." + method + ":" + params); var data = JSON.stringify({ "params": "1" }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": 2 }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify( params ); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": params, "method": method, "id": requestId }); log.info("Processed a JSON-RPC object: " + data); session.writeData(data); | log.warn("JSON-RPC request could not be sent."); this.callbacks[requestId] = null; this.syncRequestResults[requestId] = new Error("JSON-RPC request could not be sent"); } | this.request = function(session, method, params, callback, requestId) { if (requestId == undefined || requestId == null || requestId < 0) throw("JSON-RPC communciation requested with no requestID provided."); try { log.info("TITLE: " + params[0].title); } catch (e) {} this.callbacks[requestId] = callback; log.info("Processing a JSON-RPC object..." + method + ":" + params); //log.info("Processing a JSON-RPC object..." + method + ":" + params); var data = JSON.stringify({ "params": "1" }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": 2 }); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify( params ); log.info("Processed a JSON-RPC object: " + data); var data = JSON.stringify({ "params": params, "method": method, "id": requestId }); log.info("Processed a JSON-RPC object: " + data); session.writeData(data); } |
c[i];g=g.handler.call(g.scope,a,b,this);if(d&&g===false){f=false;break}}else a==="error"&&b.exception._throw();return f},request:function(a){var b=this;this.response&&this.response.close();this.responseXml=this.responseText=this.response=null;a.url=j(a.url)?this.options.url:a.url;if(j(a.url)){ex=Xmla.Exception._newError("MISSING_URL","Xmla.request",a);ex._throw()}a.properties=h(a.properties,this.options.properties,false);a.restrictions=h(a.restrictions,this.options.restrictions,false);a.async=j(a.async)? this.options.async:a.async;a.requestTimeout=j(a.requestTimeout)?this.options.requestTimeout:a.requestTimeout;var d=Q(a);this.soapMessage=d;d={async:a.async,timeout:a.requestTimeout,data:d,error:function(){a.exception=exeception;b._requestError(a)},complete:function(c){a.xhr=c;b._requestSuccess(a)},url:a.url};if(a.username)d.username=a.username;if(a.password)d.password=a.password;if(this._fireEvent(Xmla.EVENT_REQUEST,a,true)&&(a.method==Xmla.METHOD_DISCOVER&&this._fireEvent(Xmla.EVENT_DISCOVER,a)|| a.method==Xmla.METHOD_EXECUTE&&this._fireEvent(Xmla.EVENT_EXECUTE,a)))d=M(d);return this.response},_requestError:function(a){this._fireEvent("error",a)},_requestSuccess:function(a){var b=a.xhr;this.responseXML=b.responseXML;this.responseText=b.responseText;b=a.method;var d=m(this.responseXML,w,n,"Fault");if(d.length){d=d.item(0);a.exception=new Xmla.Exception(Xmla.Exception.TYPE_ERROR,d.getElementsByTagName("faultcode").item(0).childNodes.item(0).data,d.getElementsByTagName("faultstring").item(0).childNodes.item(0).data, | var e=c.length,h=true;if(e)for(var f,i=0;i<e;i+=1){f=c[i];f=f.handler.call(f.scope,a,b,this);if(d&&f===false){h=false;break}}else a==="error"&&b.exception._throw();return h},request:function(a){var b,d=this;this.response&&this.response.close();this.responseXml=this.responseText=this.response=null;a.url=j(a.url)?this.options.url:a.url;if(j(a.url)){b=Xmla.Exception._newError("MISSING_URL","Xmla.request",a);b._throw()}a.properties=g(a.properties,this.options.properties,false);a.restrictions=g(a.restrictions, this.options.restrictions,false);a.async=j(a.async)?this.options.async:a.async;a.requestTimeout=j(a.requestTimeout)?this.options.requestTimeout:a.requestTimeout;this.soapMessage=b=Q(a);b={async:a.async,timeout:a.requestTimeout,data:b,error:function(c){a.exception=c;d._requestError(a)},complete:function(c){a.xhr=c;d._requestSuccess(a)},url:a.url};if(a.username)b.username=a.username;if(a.password)b.password=a.password;if(this._fireEvent(Xmla.EVENT_REQUEST,a,true)&&(a.method==Xmla.METHOD_DISCOVER&&this._fireEvent(Xmla.EVENT_DISCOVER, a)||a.method==Xmla.METHOD_EXECUTE&&this._fireEvent(Xmla.EVENT_EXECUTE,a)))b=L(b);return this.response},_requestError:function(a){this._fireEvent("error",a)},_requestSuccess:function(a){var b=a.xhr;this.responseXML=b.responseXML;this.responseText=b.responseText;b=a.method;var d=o(this.responseXML,v,p,"Fault");if(d.length){d=d.item(0);a.exception=new Xmla.Exception(Xmla.Exception.TYPE_ERROR,d.getElementsByTagName("faultcode").item(0).childNodes.item(0).data,d.getElementsByTagName("faultstring").item(0).childNodes.item(0).data, | c[i];g=g.handler.call(g.scope,a,b,this);if(d&&g===false){f=false;break}}else a==="error"&&b.exception._throw();return f},request:function(a){var b=this;this.response&&this.response.close();this.responseXml=this.responseText=this.response=null;a.url=j(a.url)?this.options.url:a.url;if(j(a.url)){ex=Xmla.Exception._newError("MISSING_URL","Xmla.request",a);ex._throw()}a.properties=h(a.properties,this.options.properties,false);a.restrictions=h(a.restrictions,this.options.restrictions,false);a.async=j(a.async)?this.options.async:a.async;a.requestTimeout=j(a.requestTimeout)?this.options.requestTimeout:a.requestTimeout;var d=Q(a);this.soapMessage=d;d={async:a.async,timeout:a.requestTimeout,data:d,error:function(){a.exception=exeception;b._requestError(a)},complete:function(c){a.xhr=c;b._requestSuccess(a)},url:a.url};if(a.username)d.username=a.username;if(a.password)d.password=a.password;if(this._fireEvent(Xmla.EVENT_REQUEST,a,true)&&(a.method==Xmla.METHOD_DISCOVER&&this._fireEvent(Xmla.EVENT_DISCOVER,a)||a.method==Xmla.METHOD_EXECUTE&&this._fireEvent(Xmla.EVENT_EXECUTE,a)))d=M(d);return this.response},_requestError:function(a){this._fireEvent("error",a)},_requestSuccess:function(a){var b=a.xhr;this.responseXML=b.responseXML;this.responseText=b.responseText;b=a.method;var d=m(this.responseXML,w,n,"Fault");if(d.length){d=d.item(0);a.exception=new Xmla.Exception(Xmla.Exception.TYPE_ERROR,d.getElementsByTagName("faultcode").item(0).childNodes.item(0).data,d.getElementsByTagName("faultstring").item(0).childNodes.item(0).data, |
if (request.status == 200) | if (request.status == 200 && request.getResponseHeader("Content-Type") .indexOf("text/javascript") == 0) | function Request(url, data, userData, id, timeout) { var request = false; var timer = null; var handled = false; function recvCallback() { if (request.readyState == 4) { if (handled) return; // console.log("recvCallback " + request.status); clearTimeout(timer); if (request.status == 200) handler(0, request.responseText, userData); else handler(1, null, userData); request.onreadystatechange = new Function; handled = true; } } function handleTimeout() { request.onreadystatechange = new Function; handled = true; handler(2, null, userData); }; this.abort = function() { request.onreadystatechange = new Function; handled = true; request.abort(); } if (window.XMLHttpRequest) request = new XMLHttpRequest(); else if (window.ActiveXObject) try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (err) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (err2) { } } if (!request) return; request.open('POST', url, true); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;"); if (_$_CLOSE_CONNECTION_$_) request.setRequestHeader("Connection","close"); if (timeout > 0) timer = setTimeout(handleTimeout, timeout); request.onreadystatechange = recvCallback; request.send(data); } |
if (suggestion_cache[last_suggestion_text] typeof == "undefined") { | if (typeof suggestion_cache[last_suggestion_text] == "undefined") { | function request_suggestions(){ if (q_obj.value == last_suggestion_text) return; ///TODO: Determine if there is a better way to write this code so that we don't need to use q_obj twice. last_suggestion_text = q_obj.value; /// Stop a previous, unfinished request. if (ajax_suggestions.readyState % 4) ajax_suggestions.abort(); /// Check to see if we already have this in the cache. /// Do we need to request the suggestions from the server? if (suggestion_cache[last_suggestion_text] typeof == "undefined") { post_to_server("suggestions.php", "q=" + encodeURIComponent(last_suggestion_text), ajax_suggestions); } else { show_suggestions(suggestion_cache[last_suggestion_text]); } |
} | function request_suggestions(){ if (q_obj.value == last_suggestion_text) return; ///TODO: Determine if there is a better way to write this code so that we don't need to use q_obj twice. last_suggestion_text = q_obj.value; /// Stop a previous, unfinished request. if (ajax_suggestions.readyState % 4) ajax_suggestions.abort(); /// Check to see if we already have this in the cache. /// Do we need to request the suggestions from the server? if (suggestion_cache[last_suggestion_text] typeof == "undefined") { post_to_server("suggestions.php", "q=" + encodeURIComponent(last_suggestion_text), ajax_suggestions); } else { show_suggestions(suggestion_cache[last_suggestion_text]); } |
|
if (typeof suggestion_cache[last_suggestion_text] == "undefined") { | if (typeof suggest_cache[last_suggestion_text] == "undefined") { | function request_suggestions() { clearInterval(suggest_interval); if (q_obj.value == last_suggestion_text) return; ///TODO: Determine if there is a better way to write this code so that we don't need to use q_obj twice. last_suggestion_text = q_obj.value.trim(); if (last_suggestion_text == "") return; /// Stop a previous, unfinished request. if (ajax_suggestions.readyState % 4) ajax_suggestions.abort(); /// Check to see if we already have this in the cache. /// Do we need to request the suggestions from the server? if (typeof suggestion_cache[last_suggestion_text] == "undefined") { post_to_server("suggest.php", "q=" + encodeURIComponent(last_suggestion_text), ajax_suggestions, handle_suggest); } else { show_suggestions(suggestion_cache[last_suggestion_text]); } } |
show_suggestions(suggestion_cache[last_suggestion_text]); | show_suggestions(suggest_cache[last_suggestion_text]); | function request_suggestions() { clearInterval(suggest_interval); if (q_obj.value == last_suggestion_text) return; ///TODO: Determine if there is a better way to write this code so that we don't need to use q_obj twice. last_suggestion_text = q_obj.value.trim(); if (last_suggestion_text == "") return; /// Stop a previous, unfinished request. if (ajax_suggestions.readyState % 4) ajax_suggestions.abort(); /// Check to see if we already have this in the cache. /// Do we need to request the suggestions from the server? if (typeof suggestion_cache[last_suggestion_text] == "undefined") { post_to_server("suggest.php", "q=" + encodeURIComponent(last_suggestion_text), ajax_suggestions, handle_suggest); } else { show_suggestions(suggestion_cache[last_suggestion_text]); } } |
this.key = {accidentals: []}; | this.key = {accidentals: [], root: 'none', acc: '', mode: '' }; | reset: function() { for (var property in this) { if (this.hasOwnProperty(property) && typeof this[property] !== "function") { delete this[property]; } } this.iChar = 0; this.key = {accidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; // this is for new voices that are created after we set the meter. this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', verticalPos: 0 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; // Can't have original V: lines when there is the score directive this.inEnding = false; this.inTie = false; this.inTieChord = {}; } |
this.inTie = false; this.inTieChord = {}; | reset: function() { for (var property in this) { if (this.hasOwnProperty(property) && typeof this[property] !== "function") { delete this[property]; } } this.iChar = 0; this.key = {accidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; // this is for new voices that are created after we set the meter. this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', verticalPos: 0 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; // Can't have original V: lines when there is the score directive this.inEnding = false; } |
|
this.meter = {type: 'specified', num: '4', den: '4'}; | this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; | reset: function() { this.iChar = 0; this.key = {regularKey: {num: 0, acc: 'sharp'}}; this.meter = {type: 'specified', num: '4', den: '4'}; // if no meter is specified, there is an implied one. this.hasMainTitle = false; this.default_length = 1; this.clef = 'treble'; this.warnings = null; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.tempo = null; this.voices = {}; this.currentVoice = null; this.staves = []; this.macros = {}; } |
this.clef = 'treble'; | this.clef = { type: 'treble' }; | reset: function() { this.iChar = 0; this.key = {regularKey: {num: 0, acc: 'sharp'}}; this.meter = {type: 'specified', num: '4', den: '4'}; // if no meter is specified, there is an implied one. this.hasMainTitle = false; this.default_length = 1; this.clef = 'treble'; this.warnings = null; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.tempo = null; this.voices = {}; this.currentVoice = null; this.staves = []; this.macros = {}; } |
this.barNumbers = null; this.currBarNumber = 1; this.barNumOnNextNote = null; this.inTextBlock = false; this.textBlock = ""; | reset: function() { this.iChar = 0; this.key = {regularKey: {num: 0, acc: 'sharp'}}; this.meter = {type: 'specified', num: '4', den: '4'}; // if no meter is specified, there is an implied one. this.hasMainTitle = false; this.default_length = 1; this.clef = 'treble'; this.warnings = null; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.tempo = null; this.voices = {}; this.currentVoice = null; this.staves = []; this.macros = {}; } |
|
this._startIndex = this._endIndex = this._selIndex = -1; this._div = null; this.selectItem(-1); }, | this.index = null; }, | reset: function () { this._startIndex = this._endIndex = this._selIndex = -1; this._div = null; this.selectItem(-1); }, |
for (property in this) { if (this.hasOwnProperty(property) && typeof this[property] != "function") { delete this[property]; } | for (var property in this) { if (this.hasOwnProperty(property) && typeof this[property] !== "function") { delete this[property]; | reset: function() { for (property in this) { if (this.hasOwnProperty(property) && typeof this[property] != "function") { delete this[property]; } } this.iChar = 0; this.key = {extraAccidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; // this is for new voices that are created after we set the meter. this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', middle: 6 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; // Can't have original V: lines when there is the score directive } |
this.iChar = 0; this.key = {extraAccidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', middle: 6 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; | reset: function() { for (property in this) { if (this.hasOwnProperty(property) && typeof this[property] != "function") { delete this[property]; } } this.iChar = 0; this.key = {extraAccidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; // this is for new voices that are created after we set the meter. this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', middle: 6 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; // Can't have original V: lines when there is the score directive } |
|
this.iChar = 0; this.key = {extraAccidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', middle: 6 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; } | reset: function() { for (property in this) { if (this.hasOwnProperty(property) && typeof this[property] != "function") { delete this[property]; } } this.iChar = 0; this.key = {extraAccidentals: []}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.origMeter = {type: 'specified', value: [{num: '4', den: '4'}]}; // this is for new voices that are created after we set the meter. this.hasMainTitle = false; this.default_length = 0.125; this.clef = { type: 'treble', middle: 6 }; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.voices = {}; this.staves = []; this.macros = {}; this.currBarNumber = 1; this.inTextBlock = false; this.textBlock = ""; this.score_is_present = false; // Can't have original V: lines when there is the score directive } |
|
delete this.fontVocal; | reset: function() { this.iChar = 0; this.key = {regularKey: {num: 0, acc: 'sharp'}}; this.meter = {type: 'specified', value: [{num: '4', den: '4'}]}; // if no meter is specified, there is an implied one. this.hasMainTitle = false; this.default_length = 1; this.clef = { type: 'treble' }; this.warnings = null; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.tempo = null; this.voices = {}; this.currentVoice = null; this.staves = []; this.macros = {}; this.barNumbers = null; this.currBarNumber = 1; this.barNumOnNextNote = null; this.inTextBlock = false; this.textBlock = ""; } |
|
this.macros = {}; | reset: function() { this.iChar = 0; this.key = {regularKey: {num: 0, acc: 'sharp'}}; this.meter = {type: 'specified', num: '4', den: '4'}; // if no meter is specified, there is an implied one. this.hasMainTitle = false; this.default_length = 1; this.clef = 'treble'; this.warnings = null; this.next_note_duration = 0; this.start_new_line = true; this.is_in_header = true; this.is_in_history = false; this.partForNextLine = ""; this.havent_set_length = true; this.tempo = null; this.voices = {}; this.currentVoice = null; this.staves = []; } |
|
reset: function () { | this.reset = function () { | reset: function () { this.metaText = {}; this.formatting = {}; this.lines = []; this.staffNum = 0; this.voiceNum = 0; this.lineNum = 0; }, |
}, | }; | reset: function () { this.metaText = {}; this.formatting = {}; this.lines = []; this.staffNum = 0; this.voiceNum = 0; this.lineNum = 0; }, |
this.storeProxy.conn.jsonData.data.noPrivileges = !this.showPrivileges; | this.storeProxy.conn.jsonData.data.noPrivileges = !this.usePrivileges; | resetFilter : function() { this.textFilter.setValue(null); this.selectedFilter.toggle(false); this.rolesFilter.toggle(true); this.privilegesFilter.toggle(true); this.storeProxy.conn.jsonData.data.name = null; this.storeProxy.conn.jsonData.data.selectedRoleIds = []; this.storeProxy.conn.jsonData.data.selectedPrivilegeIds = []; this.storeProxy.conn.jsonData.data.noRoles = false; this.storeProxy.conn.jsonData.data.noPrivileges = !this.showPrivileges; this.store.load({ params : { start : 0, limit : 25 } }); } |
var allTree = this.find('name', 'all-roles-privs-tree')[0]; var selectedTree = this.find('name', 'roles-privs-tree')[0]; while (allTree.root.lastChild) { allTree.root.removeChild(allTree.root.lastChild); } while (selectedTree.root.lastChild) { selectedTree.root.removeChild(selectedTree.root.lastChild); } this.initializeRolesTreeHelper(allTree); if (this.payload.data.roles) { this.loadTreeHelper(allTree, selectedTree, this.payload.data.roles); } this.initializePrivilegesTreeHelper(allTree); if (this.payload.data.privileges) { this.loadTreeHelper(allTree, selectedTree, this.payload.data.privileges); } this.sortTree(allTree); this.sortTree(selectedTree); | resetHandler : function(button, event) { this.el.mask('Loading...', 'x-mask-loading'); Sonatype.repoServer.DefaultRoleEditor.superclass.resetHandler.call(this, button, event); var allTree = this.find('name', 'all-roles-privs-tree')[0]; var selectedTree = this.find('name', 'roles-privs-tree')[0]; while (allTree.root.lastChild) { allTree.root.removeChild(allTree.root.lastChild); } while (selectedTree.root.lastChild) { selectedTree.root.removeChild(selectedTree.root.lastChild); } this.initializeRolesTreeHelper(allTree); if (this.payload.data.roles) { this.loadTreeHelper(allTree, selectedTree, this.payload.data.roles); } this.initializePrivilegesTreeHelper(allTree); if (this.payload.data.privileges) { this.loadTreeHelper(allTree, selectedTree, this.payload.data.privileges); } this.sortTree(allTree); this.sortTree(selectedTree); if (this.presetData) { this.getForm().setValues(this.presetData); } this.el.unmask(); }, |
|
Sonatype.MessageBox.alert('Password Reseted', 'The password has been reset.'); | Sonatype.MessageBox.alert('Password Reset', 'The password has been reset.'); | resetPasswordCallback : function(options, isSuccess, response) { if (isSuccess) { Sonatype.MessageBox.alert('Password Reseted', 'The password has been reset.'); } else { Sonatype.utils.connectionError(response, 'The server did not reset the password.'); } }, |
p.getChild([1,0,0,0,2]).unselectable();if(f==CKEDITOR.ELEMENT_MODE_REPLACE)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="cke_editor_'+b.name.replace('.','\\.')+'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild(4)}};},destroy:function(b){var c=b.container;c.clearCustomData();b.element.clearCustomData();if(CKEDITOR.env.ie){c.setStyle('display','none');var d=document.body.createTextRange();d.moveToElementText(c.$);try{d.select();}catch(e){}}if(c)c.remove();if(b.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE)b.element.show();delete b.element;}};})());CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=/^\d+$/;if(e.test(a))a+='px';var f=this.container,g=CKEDITOR.document.getById('cke_contents_'+this.name),h=d?f.getChild(1):f;CKEDITOR.env.webkit&&h.setStyle('display','none'); h.setStyle('width',a);if(CKEDITOR.env.webkit){h.$.offsetWidth;h.setStyle('display','');}var i=c?0:(h.$.offsetHeight||0)-(g.$.clientHeight||0);g.setStyle('height',Math.max(b-i,0)+'px');this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container.getChild(1);}; | p.getChild([1,0,0,0,0]).unselectable();p.getChild([1,0,0,0,2]).unselectable();if(f==CKEDITOR.ELEMENT_MODE_REPLACE)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="cke_editor_'+b.name.replace('.','\\.')+'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild(4)}};},destroy:function(b){var c=b.container;c.clearCustomData();b.element.clearCustomData();if(c)c.remove();if(b.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE)b.element.show();delete b.element;}};})());CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=this.container,f=CKEDITOR.document.getById('cke_contents_'+this.name),g=d?e.getChild(1):e;CKEDITOR.env.webkit&&g.setStyle('display','none');g.setSize('width',a,true);if(CKEDITOR.env.webkit){g.$.offsetWidth;g.setStyle('display','');}var h=c?0:(g.$.offsetHeight||0)-(f.$.clientHeight||0); f.setStyle('height',Math.max(b-h,0)+'px');this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container.getChild(1);}; | p.getChild([1,0,0,0,2]).unselectable();if(f==CKEDITOR.ELEMENT_MODE_REPLACE)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="cke_editor_'+b.name.replace('.','\\.')+'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild(4)}};},destroy:function(b){var c=b.container;c.clearCustomData();b.element.clearCustomData();if(CKEDITOR.env.ie){c.setStyle('display','none');var d=document.body.createTextRange();d.moveToElementText(c.$);try{d.select();}catch(e){}}if(c)c.remove();if(b.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE)b.element.show();delete b.element;}};})());CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=/^\d+$/;if(e.test(a))a+='px';var f=this.container,g=CKEDITOR.document.getById('cke_contents_'+this.name),h=d?f.getChild(1):f;CKEDITOR.env.webkit&&h.setStyle('display','none');h.setStyle('width',a);if(CKEDITOR.env.webkit){h.$.offsetWidth;h.setStyle('display','');}var i=c?0:(h.$.offsetHeight||0)-(g.$.clientHeight||0);g.setStyle('height',Math.max(b-i,0)+'px');this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container.getChild(1);}; |
h.style.left = (WT.pxself(h, 'left') + delta) + 'px'; | function resizeColumn(header, delta) { var columnClass = header.className.split(' ')[0], columnId = columnClass.substring(7) * 1, headers = headerContainer.firstChild, contents = contentsContainer.firstChild, column = $(contents).find('.' + columnClass).get(0), h = header.nextSibling, c = column.nextSibling, newWidth = WT.pxself(header, 'width') - 1 + delta; headers.style.width = contents.style.width = (WT.pxself(headers, 'width') + delta) + 'px'; header.style.width = (newWidth + 1) + 'px'; column.style.width = (newWidth + 7) + 'px'; for (; h; h = h.nextSibling) { h.style.left = (WT.pxself(h, 'left') + delta) + 'px'; if (c) { c.style.left = (WT.pxself(c, 'left') + delta) + 'px'; c = c.nextSibling; } } APP.emit(el, 'columnResized', columnId, newWidth); } |
|
APP.emit(el, 'columnResized', columnId, newWidth); | APP.emit(el, 'columnResized', columnId, parseInt(newWidth)); | function resizeColumn(header, delta) { var columnClass = header.className.split(' ')[0], columnId = columnClass.substring(7) * 1, headers = headerContainer.firstChild, contents = contentsContainer.firstChild, column = $(contents).find('.' + columnClass).get(0), h = header.nextSibling, c = column.nextSibling, newWidth = WT.pxself(header, 'width') - 1 + delta; headers.style.width = contents.style.width = (WT.pxself(headers, 'width') + delta) + 'px'; header.style.width = (newWidth + 1) + 'px'; column.style.width = (newWidth + 7) + 'px'; for (; h; h = h.nextSibling) { if (c) { c.style.left = (WT.pxself(c, 'left') + delta) + 'px'; c = c.nextSibling; } } APP.emit(el, 'columnResized', columnId, newWidth); } |
t=0,u=0,v=0;f.onscroll=function(){p.scrollLeft=f.scrollLeft;if(f.scrollTop<u||f.scrollTop>v||f.scrollLeft<s||f.scrollLeft>t)n.emit(j,"scrolled",f.scrollLeft,f.scrollTop,f.clientWidth,f.clientHeight)};this.mouseDown=function(a,b){i.capture(null);a=q(b);j.getAttribute("drag")==="true"&&a.selected&&n._p_.dragStart(j,b)};this.resizeHandleMDown=function(a,b){var c=a.parentNode.parentNode,d=-(i.pxself(c,"width")-1);new i.SizeHandle(i,"h",a.offsetWidth,j.offsetHeight,d,1E4,"Wt-hsh",function(k){w(c,k)},a, j,b,-2,-1)};this.scrolled=function(a,b,c,d){s=a;t=b;u=c;v=d};var m=null;j.handleDragDrop=function(a,b,c,d,k){if(m){m.className=m.classNameOrig;m=null}if(a!="end"){var g=q(c);if(!g.selected&&g.drop)if(a=="drop")n.emit(j,{name:"dropEvent",eventObject:b,event:c},g.rowIdx,g.columnId,d,k);else{b.className="Wt-valid-drop";m=g.el;m.classNameOrig=m.className;m.className+=" Wt-drop-site"}else b.className=""}};j.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9){i.cancelEvent(b);var c=q(b);if(c.el){a= | f.scrollLeft;if(f.scrollTop<u||f.scrollTop>v||f.scrollLeft<s||f.scrollLeft>t)n.emit(h,"scrolled",f.scrollLeft,f.scrollTop,f.clientWidth,f.clientHeight)};this.mouseDown=function(a,b){i.capture(null);a=q(b);h.getAttribute("drag")==="true"&&a.selected&&n._p_.dragStart(h,b)};this.resizeHandleMDown=function(a,b){var c=a.parentNode.parentNode,d=-(i.pxself(c,"width")-1);new i.SizeHandle(i,"h",a.offsetWidth,h.offsetHeight,d,1E4,"Wt-hsh",function(k){w(c,k)},a,h,b,-2,-1)};this.scrolled=function(a,b,c,d){s= | t=0,u=0,v=0;f.onscroll=function(){p.scrollLeft=f.scrollLeft;if(f.scrollTop<u||f.scrollTop>v||f.scrollLeft<s||f.scrollLeft>t)n.emit(j,"scrolled",f.scrollLeft,f.scrollTop,f.clientWidth,f.clientHeight)};this.mouseDown=function(a,b){i.capture(null);a=q(b);j.getAttribute("drag")==="true"&&a.selected&&n._p_.dragStart(j,b)};this.resizeHandleMDown=function(a,b){var c=a.parentNode.parentNode,d=-(i.pxself(c,"width")-1);new i.SizeHandle(i,"h",a.offsetWidth,j.offsetHeight,d,1E4,"Wt-hsh",function(k){w(c,k)},a,j,b,-2,-1)};this.scrolled=function(a,b,c,d){s=a;t=b;u=c;v=d};var m=null;j.handleDragDrop=function(a,b,c,d,k){if(m){m.className=m.classNameOrig;m=null}if(a!="end"){var g=q(c);if(!g.selected&&g.drop)if(a=="drop")n.emit(j,{name:"dropEvent",eventObject:b,event:c},g.rowIdx,g.columnId,d,k);else{b.className="Wt-valid-drop";m=g.el;m.classNameOrig=m.className;m.className+=" Wt-drop-site"}else b.className=""}};j.onkeydown=function(a){var b=a||window.event;if(b.keyCode==9){i.cancelEvent(b);var c=q(b);if(c.el){a= |
APP.emit(el, 'columnResized', columnId, newWidth); | APP.emit(el, 'columnResized', columnId, parseInt(newWidth)); | this.resizeHandleMDown = function(obj, event) { var parent = obj.parentNode.parentNode, c = parent.className.split(' ')[0]; if (c) { var r = WT.getCssRule('#' + el.id + ' .' + c), cw = WT.pxself(r, 'width'), minDelta = -cw, maxDelta = 10000; new WT.SizeHandle(WT, 'h', obj.offsetWidth, el.offsetHeight, minDelta, maxDelta, 'Wt-hsh', function (delta) { var newWidth = cw + delta, columnId = c.substring(7) * 1; r.style.width = newWidth + 'px'; self.adjustColumns(); APP.emit(el, 'columnResized', columnId, newWidth); }, obj, el, event, -2, -1); } }; |
event:a},b.nodeId,b.columnId,"mousedown","","");d.getAttribute("drag")==="true"&&b.selected&&l._p_.dragStart(d,a)}};this.mouseUp=function(c,a){var b=n(a);b.columnId!=-1&&l.emit(d,{name:"itemEvent",eventObject:c,event:a},b.nodeId,b.columnId,"mouseup","","")};this.resizeHandleMDown=function(c,a){a=g.pageCoordinates(a);c.setAttribute("dsx",a.x)};this.resizeHandleMMoved=function(c,a){var b=c.getAttribute("dsx"),f=j.lastChild.className.split(" ")[0];g.getCssRule("#"+d.id+" ."+f);if(b!=null&&b!=""){f=g.pageCoordinates(a); var e=c.parentNode.parentNode;b=Math.max(f.x-b,-e.offsetWidth);if(e=e.className.split(" ")[0]){e=g.getCssRule("#"+d.id+" ."+e);var h=g.pxself(e,"width");e.style.width=Math.max(0,h+b)+"px"}this.adjustColumns();c.setAttribute("dsx",f.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=j.firstChild,b=0,f=0;f=j.lastChild.className.split(" ")[0];f=g.getCssRule("#"+d.id+" ."+f);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var e= | event:a},b.nodeId,b.columnId,"mousedown","","");d.getAttribute("drag")==="true"&&b.selected&&m._p_.dragStart(d,a)}};this.mouseUp=function(c,a){var b=n(a);b.columnId!=-1&&m.emit(d,{name:"itemEvent",eventObject:c,event:a},b.nodeId,b.columnId,"mouseup","","")};this.resizeHandleMDown=function(c,a){a=g.pageCoordinates(a);c.setAttribute("dsx",a.x)};this.resizeHandleMMoved=function(c,a){var b=c.getAttribute("dsx"),e=k.lastChild.className.split(" ")[0];g.getCssRule("#"+d.id+" ."+e);if(b!=null&&b!=""){e=g.pageCoordinates(a); var f=c.parentNode.parentNode;b=Math.max(e.x-b,-f.offsetWidth);if(f=f.className.split(" ")[0]){f=g.getCssRule("#"+d.id+" ."+f);var j=g.pxself(f,"width");f.style.width=Math.max(0,j+b)+"px"}this.adjustColumns();c.setAttribute("dsx",e.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=k.firstChild,b=0,e=0;e=k.lastChild.className.split(" ")[0];e=g.getCssRule("#"+d.id+" ."+e);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var f= | event:a},b.nodeId,b.columnId,"mousedown","","");d.getAttribute("drag")==="true"&&b.selected&&l._p_.dragStart(d,a)}};this.mouseUp=function(c,a){var b=n(a);b.columnId!=-1&&l.emit(d,{name:"itemEvent",eventObject:c,event:a},b.nodeId,b.columnId,"mouseup","","")};this.resizeHandleMDown=function(c,a){a=g.pageCoordinates(a);c.setAttribute("dsx",a.x)};this.resizeHandleMMoved=function(c,a){var b=c.getAttribute("dsx"),f=j.lastChild.className.split(" ")[0];g.getCssRule("#"+d.id+" ."+f);if(b!=null&&b!=""){f=g.pageCoordinates(a);var e=c.parentNode.parentNode;b=Math.max(f.x-b,-e.offsetWidth);if(e=e.className.split(" ")[0]){e=g.getCssRule("#"+d.id+" ."+e);var h=g.pxself(e,"width");e.style.width=Math.max(0,h+b)+"px"}this.adjustColumns();c.setAttribute("dsx",f.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=j.firstChild,b=0,f=0;f=j.lastChild.className.split(" ")[0];f=g.getCssRule("#"+d.id+" ."+f);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var e= |
var e=c.parentNode.parentNode;b=Math.max(f.x-b,-e.offsetWidth);if(e=e.className.split(" ")[0]){e=g.getCssRule("#"+d.id+" ."+e);var h=g.pxself(e,"width");e.style.width=Math.max(0,h+b)+"px"}this.adjustColumns();c.setAttribute("dsx",f.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=j.firstChild,b=0,f=0;f=j.lastChild.className.split(" ")[0];f=g.getCssRule("#"+d.id+" ."+f);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var e= | var f=c.parentNode.parentNode;b=Math.max(e.x-b,-f.offsetWidth);if(f=f.className.split(" ")[0]){f=g.getCssRule("#"+d.id+" ."+f);var j=g.pxself(f,"width");f.style.width=Math.max(0,j+b)+"px"}this.adjustColumns();c.setAttribute("dsx",e.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=k.firstChild,b=0,e=0;e=k.lastChild.className.split(" ")[0];e=g.getCssRule("#"+d.id+" ."+e);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var f= | var e=c.parentNode.parentNode;b=Math.max(f.x-b,-e.offsetWidth);if(e=e.className.split(" ")[0]){e=g.getCssRule("#"+d.id+" ."+e);var h=g.pxself(e,"width");e.style.width=Math.max(0,h+b)+"px"}this.adjustColumns();c.setAttribute("dsx",f.x);g.cancelEvent(a)}};this.resizeHandleMUp=function(c,a){c.removeAttribute("dsx");g.cancelEvent(a)};this.adjustColumns=function(){var c=o.firstChild,a=j.firstChild,b=0,f=0;f=j.lastChild.className.split(" ")[0];f=g.getCssRule("#"+d.id+" ."+f);if(q)a=a.firstChild;if(!g.isHidden(d)){for(var e= |
if (!e) e=window.event; if ($("d_scrollbody") && $("t_nscrollbody")) { | if (!e) e= window.event; | function resizeHandler (e) { if (!e) e=window.event; if ($("d_scrollbody") && $("t_nscrollbody")) { var contentHeight= document.viewport.getHeight() - 216; if ($$('div.plugin-actions').length != 0) { var height= 0; $$('div.plugin-actions').each(function(s) { height+= s.getHeight(); }); contentHeight-= height + 5; } document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } return true;} |
document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; | if (Prototype.Browser.Gecko){ if ($("d_scrollbody") && $("t_nscrollbody")) { document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } } else { document.getElementById('d_scrollbody').style.minHeight = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.minHeight = contentHeight+'px'; | function resizeHandler (e) { if (!e) e=window.event; if ($("d_scrollbody") && $("t_nscrollbody")) { var contentHeight= document.viewport.getHeight() - 216; if ($$('div.plugin-actions').length != 0) { var height= 0; $$('div.plugin-actions').each(function(s) { height+= s.getHeight(); }); contentHeight-= height + 5; } document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } return true;} |
document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } | if (Prototype.Browser.Gecko || Prototype.Browser.IE) { document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } else { document.getElementById('d_scrollbody').style.minHeight = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.minHeight = contentHeight+'px'; } } | function resizeHandler (e) { if (!e) e= window.event; // This works with FF / IE9. If Apples resolves a bug in webkit, // it works with Safari/Chrome, too. if ($("d_scrollbody") && $("t_nscrollbody")) { var contentHeight= document.viewport.getHeight() - 216; if ($$('div.plugin-actions').length != 0) { var height= 0; $$('div.plugin-actions').each(function(s) { height+= s.getHeight(); }); contentHeight-= height + 5; } document.getElementById('d_scrollbody').style.height = contentHeight+23+'px'; document.getElementById('t_nscrollbody').style.height = contentHeight+'px'; } return true;} |
var dur = multilineVars.default_length ? multilineVars.default_length / 8 : 1/8; for (var i = 0; i < multilineVars.tempo.duration; i++) multilineVars.tempo.duration[i] = dur * multilineVars.tempo.duration[i]; | calcTempo(multilineVars.tempo); | function resolveTempo() { if (multilineVars.tempo) { // If there's a tempo waiting to be resolved var dur = multilineVars.default_length ? multilineVars.default_length / 8 : 1/8; for (var i = 0; i < multilineVars.tempo.duration; i++) multilineVars.tempo.duration[i] = dur * multilineVars.tempo.duration[i]; tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } |
}.bind(this) | }.bind(this), onFailure: indicateFail | restartPackage: function(event) { indicateLoad(); new Request({ method: 'get', url: '/json/restart_package/'+this.id, onSuccess: function(){ var child = this.ele.getElement('.children'); if (child.getStyle('display') == "block") { child.dissolve(); } var ul = $("sort_children_{id}".substitute({"id": this.id})); ul.erase("html"); this.linksLoaded = false; indicateSuccess(); }.bind(this) }).send(); event.stop(); }, |
return repoRecord.data.repositoryURI + '/content' + node.data.relativePath; | return repoRecord.data.resourceURI + '/content' + node.data.relativePath; | restToContentUrl : function(node, repoRecord) { return repoRecord.data.repositoryURI + '/content' + node.data.relativePath; }, |
returnToEntranceHall : function(e) { e.stop(); | returnToEntranceHall : function() { | returnToEntranceHall : function(e) { e.stop(); logControls.addClass('hide'); messageList.removeClass('logging'); $('header').removeClass('hide'); $('content').removeClass('hide'); $('entranceHall').removeClass('hide'); $('soundOptions').removeClass('hide'); $('onlineListContainer').removeClass('hide'); MBchat.updateables.poller.start(); MBchat.updateables.message.leaveRoom(); //go To Entrance Hall } |
[settings.effect](settings.effectspeed);self.loaded=true;});};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});};$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0})","above-the-fold":"!$.belowthefold(a, {threshold : 0})","right-of-fold":"$.rightoffold(a, {threshold : 0})","left-of-fold":"!$.rightoffold(a, {threshold : 0})"});})(jQuery); | return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}else{var fold=$(settings.container).offset().left+$(settings.container).width();} return fold<=$(element).offset().left-settings.threshold;};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop();}else{var fold=$(settings.container).offset().top;} | [settings.effect](settings.effectspeed);self.loaded=true;});};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});};$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0})","above-the-fold":"!$.belowthefold(a, {threshold : 0})","right-of-fold":"$.rightoffold(a, {threshold : 0})","left-of-fold":"!$.rightoffold(a, {threshold : 0})"});})(jQuery); |
window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; | if ("result" in resultWrapper && resultWrapper.result !== false) { if (resultWrapper.result !== null) window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; else window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = new Error("Null return result received"); } else window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = new Error(resultWrapper.error); | this.request(session, method, params, function rpc_callback(resultWrapper) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow("navigator:browser"); window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; }, myRequestId); |
this.browserWindow.IC1setupKI(this.mainWindow); | this.browserWindow.IC1setupKRPC(this.mainWindow); | run: function() { try { KFLog.debug(this.source + ' thread signalled "' + this.reason + '" with result: ' + this.result); switch (this.source) { case "executableInstallerRunner": if (this.reason == "IC1NETSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_NET_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_NET_EXECUTED; this.browserWindow.IC1setupKP(this.mainWindow); } else if (this.reason == "IC1NET35SetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_NET35_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_NET35_EXECUTED; this.browserWindow.IC1setupKP(this.mainWindow); } else if (this.reason == "IC1KPSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_KP_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_KP_EXECUTED; this.browserWindow.IC1setupKI(this.mainWindow); } else if (this.reason == "IC2KPSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_KP_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_KP_EXECUTED; this.browserWindow.IC2setupKI(this.mainWindow); } break; case "IC1PriDownload": this.handleIC1PriDownload(); break; case "IC1SecDownload": this.handleIC1SecDownload(); break; case "IC2PriDownload": this.handleIC2PriDownload(); break; case "IC5PriDownload": this.handleIC5PriDownload(); break; } } catch (err) { Components.utils.reportError(err); } }, |
this.browserWindow.IC2setupKI(this.mainWindow); | this.browserWindow.IC2setupKRPC(this.mainWindow); | run: function() { try { KFLog.debug(this.source + ' thread signalled "' + this.reason + '" with result: ' + this.result); switch (this.source) { case "executableInstallerRunner": if (this.reason == "IC1NETSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_NET_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_NET_EXECUTED; this.browserWindow.IC1setupKP(this.mainWindow); } else if (this.reason == "IC1NET35SetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_NET35_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_NET35_EXECUTED; this.browserWindow.IC1setupKP(this.mainWindow); } else if (this.reason == "IC1KPSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_KP_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_KP_EXECUTED; this.browserWindow.IC1setupKI(this.mainWindow); } else if (this.reason == "IC2KPSetupFinished") { this.browserWindow.installState ^= this.browserWindow.installState & this.browserWindow.KF_INSTALL_STATE_KP_EXECUTING; this.browserWindow.installState |= this.browserWindow.KF_INSTALL_STATE_KP_EXECUTED; this.browserWindow.IC2setupKI(this.mainWindow); } break; case "IC1PriDownload": this.handleIC1PriDownload(); break; case "IC1SecDownload": this.handleIC1SecDownload(); break; case "IC2PriDownload": this.handleIC2PriDownload(); break; case "IC5PriDownload": this.handleIC5PriDownload(); break; } } catch (err) { Components.utils.reportError(err); } }, |
query += "&s=" + (top_id + -1); | query += "&s=" + (top_id - 1); | function run_search(direction) { ///TODO: Rewrite code so that it does not rely on so many inner variables (such as last_type and last_search_encoded). /// last_type set in prepare_new_search(). var ajax, query = "t=" + last_type; if (direction == additional) { ajax = ajax_additional; } else { ajax = ajax_previous; query += "&d=" + direction; } /// Is the server already working on this request? ///NOTE: readyState is between 0-4, and anything 1-3 means that the server is already working on this request. if (ajax.readyState % 4) { return null; } if (last_type == verse_lookup) { if (direction == additional) { /// In order to find the next verse from which to start, it adds 1. query += "&q=" + (bottom_id + 1); } else { /// In order to find the previous verse from which to start, it subtracts 1. query += "&q=" + (top_id - 1); } var in_paragraphs = true; /// <-- TEMP /// Is it impossible to tell if this verse starts at a paragraph breaking point? ///NOTE: If this is the first lookup and the verse number is greater than 1, /// then it must ask the server to find the nearest paragraph break. if (waiting_for_first_search && in_paragraphs && ((bottom_id + 1) % 1000 > 1)) { /// Tell the server to find the nearest paragraph break. query += "&f=1"; } } else { query += "&q=" + last_search_encoded; if (direction == additional) { /// Continue starting on the next verse. if (bottom_id > 0) { query += "&s=" + (bottom_id + 1); } } else { /// Continue starting backwards on the previous verse. query += "&s=" + (top_id + -1); } } post_to_server("search.php", query, ajax, handle_new_verses, {action: last_type, "direction": direction}); } |
post_to_server("search.php", query, ajax, handle_new_verses, {action: last_type, "direction": direction}); | post_to_server("search.php", query, ajax, handle_new_verses, extra_data); | function run_search(direction) { ///TODO: Rewrite code so that it does not rely on so many inner variables (such as last_type and last_search_encoded). /// last_type set in prepare_new_search(). var ajax, query = "t=" + last_type; if (direction == additional) { ajax = ajax_additional; } else { ajax = ajax_previous; query += "&d=" + direction; } /// Is the server already working on this request? ///NOTE: readyState is between 0-4, and anything 1-3 means that the server is already working on this request. if (ajax.readyState % 4) { return null; } if (last_type == verse_lookup) { if (direction == additional) { /// In order to find the next verse from which to start, it adds 1. query += "&q=" + (bottom_id + 1); } else { /// In order to find the previous verse from which to start, it subtracts 1. query += "&q=" + (top_id - 1); } var in_paragraphs = true; /// <-- TEMP /// Is it impossible to tell if this verse starts at a paragraph breaking point? ///NOTE: If this is the first lookup and the verse number is greater than 1, /// then it must ask the server to find the nearest paragraph break. if (waiting_for_first_search && in_paragraphs && ((bottom_id + 1) % 1000 > 1)) { /// Tell the server to find the nearest paragraph break. query += "&f=1"; } } else { query += "&q=" + last_search_encoded; if (direction == additional) { /// Continue starting on the next verse. if (bottom_id > 0) { query += "&s=" + (bottom_id + 1); } } else { /// Continue starting backwards on the previous verse. query += "&s=" + (top_id + -1); } } post_to_server("search.php", query, ajax, handle_new_verses, {action: last_type, "direction": direction}); } |
file.initWithPath("batch script that calls VBS elevation routines..."); | file.initWithPath(this._myDepsDir() + "\\KeeFoxElevate.exe"); | runAnInstaller: function (fileName, params) { var args = [fileName, params]; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath("batch script that calls VBS elevation routines..."); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); process.init(file); process.run(true, args, 2); }, |
this._KFLog.info("about to execute: " + file.path + " " + args.join(' ')); | runAnInstaller: function (fileName, params) { var args = [fileName, params]; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath("batch script that calls VBS elevation routines..."); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); process.init(file); process.run(true, args, 2); }, |
|
runAnInstaller: function (fileName, params) | runAnInstaller: function (fileName, params, callback) | runAnInstaller: function (fileName, params) { var args = [fileName, params]; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(this._myDepsDir() + "\\KeeFoxElevate.exe"); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); this._KFLog.info("about to execute: " + file.path + " " + args.join(' ')); process.init(file); process.run(true, args, 2); }, |
.createInstance(Components.interfaces.nsIProcess); | .createInstance(Components.interfaces.nsIProcess2 || Components.interfaces.nsIProcess); | runAnInstaller: function (fileName, params) { var args = [fileName, params]; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(this._myDepsDir() + "\\KeeFoxElevate.exe"); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); this._KFLog.info("about to execute: " + file.path + " " + args.join(' ')); process.init(file); process.run(true, args, 2); }, |
process.run(true, args, 2); | if (callback == undefined || callback == null) process.run(true,args,2); else process.runAsync(args, 2, callback); | runAnInstaller: function (fileName, params) { var args = [fileName, params]; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(this._myDepsDir() + "\\KeeFoxElevate.exe"); var process = Components.classes["@mozilla.org/process/util;1"] .createInstance(Components.interfaces.nsIProcess); this._KFLog.info("about to execute: " + file.path + " " + args.join(' ')); process.init(file); process.run(true, args, 2); }, |
var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); | Tapx.runModalDialog = function(title, message, proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(message)); | var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; |
Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; | Modalbox.show(div, { title : title, afterLoad : function() { $(noId).observe("click", function(event) { Modalbox.hide(); }); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; | var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; |
$(yesId).observe("click", function() { | $(yesId).observe("click", function(event) { event.stop(); | var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function() { Modalbox.hide(); proceed.defer(); }); } }); }; |
j.charCode;if(j.altKey)e+=c+"altKey=1";if(j.ctrlKey)e+=c+"ctrlKey=1";if(j.metaKey)e+=c+"metaKey=1";if(j.shiftKey)e+=c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback;d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function Y(){P=true;if(W){clearTimeout(W);W=null}var d=$("#Wt-timers");d.size()>0&&m.setHtml(d.get(0),"",false)}function a(){m.history._initTimeout();X==0&&z(null,"none",null,false);W=setTimeout(a,_$_KEEP_ALIVE_$_000)}function b(d){if(!m.isIEMobile)document.title= | 4)i=4;e+=c+"button="+i;if(typeof j.keyCode!=="undefined")e+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")e+=c+"charCode="+j.charCode;if(j.altKey)e+=c+"altKey=1";if(j.ctrlKey)e+=c+"ctrlKey=1";if(j.metaKey)e+=c+"metaKey=1";if(j.shiftKey)e+=c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback;d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function U(){P=true;if(X){clearTimeout(X);X=null}var d=$("#Wt-timers");d.size()>0&&m.setHtml(d.get(0), | j.charCode;if(j.altKey)e+=c+"altKey=1";if(j.ctrlKey)e+=c+"ctrlKey=1";if(j.metaKey)e+=c+"metaKey=1";if(j.shiftKey)e+=c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback;d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function Y(){P=true;if(W){clearTimeout(W);W=null}var d=$("#Wt-timers");d.size()>0&&m.setHtml(d.get(0),"",false)}function a(){m.history._initTimeout();X==0&&z(null,"none",null,false);W=setTimeout(a,_$_KEEP_ALIVE_$_000)}function b(d){if(!m.isIEMobile)document.title= |
ia>g.updateDelay){clearTimeout(S);s()}}function q(d){ea=d;E._p_.comm.responseReceived(d)}function s(){S=null;if(R){if(!ja){if(confirm("The application was quited, do you want to restart?"))document.location=document.location;ja=true}}else{var d,c,f,k="&rand="+Math.round(Math.random(ka)*1E5);if(z.length>0){d=h();c=d.feedback?setTimeout(b,_$_INDICATOR_TIMEOUT_$_):null;f=false}else{d={result:"signal=poll"};c=null;f=true}K=E._p_.comm.sendUpdate(la+k,"request=jsupdate&"+d.result+"&ackId="+ea,c,ea,-1); N=f?setTimeout(n,_$_SERVER_PUSH_TIMEOUT_$_):null}}function y(d,c){var f={},k=z.length;f.signal="user";f.id=typeof d==="string"?d:d==E?"app":d.id;if(typeof c==="object"){f.name=c.name;f.object=c.eventObject;f.event=c.event}else{f.name=c;f.object=f.event=null}f.args=[];for(var m=2;m<arguments.length;++m){var i=arguments[m];i=i===false?0:i===true?1:i.toDateString?i.toDateString():i;f.args[m-2]=i}f.feedback=true;z[k]=aa(f,k);u()}function I(d,c,f){var k=function(){var i=g.getElement(d);if(i){if(f)i.timer= | ia>g.updateDelay){clearTimeout(S);s()}}function q(d){ea=d;E._p_.comm.responseReceived(d)}function s(){if(!J){S=null;if(R){if(!ja){if(confirm("The application was quited, do you want to restart?"))document.location=document.location;ja=true}}else{var d,c,f,k="&rand="+Math.round(Math.random(ka)*1E5);if(z.length>0){d=h();c=d.feedback?setTimeout(b,_$_INDICATOR_TIMEOUT_$_):null;f=false}else{d={result:"&signal=poll"};c=null;f=true}J=E._p_.comm.sendUpdate(la+k,"request=jsupdate"+d.result+"&ackId="+ea,c, ea,-1);N=f?setTimeout(n,_$_SERVER_PUSH_TIMEOUT_$_):null}}}function y(d,c){var f={},k=z.length;f.signal="user";f.id=typeof d==="string"?d:d==E?"app":d.id;if(typeof c==="object"){f.name=c.name;f.object=c.eventObject;f.event=c.event}else{f.name=c;f.object=f.event=null}f.args=[];for(var m=2;m<arguments.length;++m){var i=arguments[m];i=i===false?0:i===true?1:i.toDateString?i.toDateString():i;f.args[m-2]=i}f.feedback=true;z[k]=aa(f,k);u()}function I(d,c,f){var k=function(){var i=g.getElement(d);if(i){if(f)i.timer= | ia>g.updateDelay){clearTimeout(S);s()}}function q(d){ea=d;E._p_.comm.responseReceived(d)}function s(){S=null;if(R){if(!ja){if(confirm("The application was quited, do you want to restart?"))document.location=document.location;ja=true}}else{var d,c,f,k="&rand="+Math.round(Math.random(ka)*1E5);if(z.length>0){d=h();c=d.feedback?setTimeout(b,_$_INDICATOR_TIMEOUT_$_):null;f=false}else{d={result:"signal=poll"};c=null;f=true}K=E._p_.comm.sendUpdate(la+k,"request=jsupdate&"+d.result+"&ackId="+ea,c,ea,-1);N=f?setTimeout(n,_$_SERVER_PUSH_TIMEOUT_$_):null}}function y(d,c){var f={},k=z.length;f.signal="user";f.id=typeof d==="string"?d:d==E?"app":d.id;if(typeof c==="object"){f.name=c.name;f.object=c.eventObject;f.event=c.event}else{f.name=c;f.object=f.event=null}f.args=[];for(var m=2;m<arguments.length;++m){var i=arguments[m];i=i===false?0:i===true?1:i.toDateString?i.toDateString():i;f.args[m-2]=i}f.feedback=true;z[k]=aa(f,k);u()}function I(d,c,f){var k=function(){var i=g.getElement(d);if(i){if(f)i.timer= |
d.object.clientHeight+c+"widgetX="+(i-m.x)+c+"widgetY="+(z-m.y)}i=n.button(j);if(!i)if(n.buttons&1)i=1;else if(n.buttons&2)i=2;else if(n.buttons&4)i=4;e+=c+"button="+i;if(typeof j.keyCode!=="undefined")e+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")e+=c+"charCode="+j.charCode;if(j.altKey)e+=c+"altKey=1";if(j.ctrlKey)e+=c+"ctrlKey=1";if(j.metaKey)e+=c+"metaKey=1";if(j.shiftKey)e+=c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback; d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function Y(){P=true;if(W){clearTimeout(W);W=null}var d=$("#Wt-timers");d.size()>0&&n.setHtml(d.get(0),"",false)}function a(){n.history._initTimeout();X==0&&y(null,"none",null,false);W=setTimeout(a,_$_KEEP_ALIVE_$_000)}function b(d){if(!n.isIEMobile)document.title=d}function f(){if(!document.activeElement){function d(e){if(e&&e.target)document.activeElement=e.target==document?null:e.target}function c(){document.activeElement=null}document.addEventListener("focus", | c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback;d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function Y(){P=true;if(W){clearTimeout(W);W=null}var d=$("#Wt-timers");d.size()>0&&n.setHtml(d.get(0),"",false)}function a(){n.history._initTimeout();X==0&&y(null,"none",null,false);W=setTimeout(a,_$_KEEP_ALIVE_$_000)}function b(d){if(!n.isIEMobile)document.title=d}function f(){if(!document.activeElement){function d(e){if(e&&e.target)document.activeElement= | d.object.clientHeight+c+"widgetX="+(i-m.x)+c+"widgetY="+(z-m.y)}i=n.button(j);if(!i)if(n.buttons&1)i=1;else if(n.buttons&2)i=2;else if(n.buttons&4)i=4;e+=c+"button="+i;if(typeof j.keyCode!=="undefined")e+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")e+=c+"charCode="+j.charCode;if(j.altKey)e+=c+"altKey=1";if(j.ctrlKey)e+=c+"ctrlKey=1";if(j.metaKey)e+=c+"metaKey=1";if(j.shiftKey)e+=c+"shiftKey=1";d.data=e;return d}function S(){for(var d="",c=false,e=0;e<A.length;++e){c=c||A[e].feedback;d+=A[e].data}da=A;A=[];return{feedback:c,result:d}}function Y(){P=true;if(W){clearTimeout(W);W=null}var d=$("#Wt-timers");d.size()>0&&n.setHtml(d.get(0),"",false)}function a(){n.history._initTimeout();X==0&&y(null,"none",null,false);W=setTimeout(a,_$_KEEP_ALIVE_$_000)}function b(d){if(!n.isIEMobile)document.title=d}function f(){if(!document.activeElement){function d(e){if(e&&e.target)document.activeElement=e.target==document?null:e.target}function c(){document.activeElement=null}document.addEventListener("focus", |
E=false,R=null,A=[],I,z,Q=function(){};if(!document.activeElement){function S(g){if(g&&g.target)document.activeElement=g.target==document?null:g.target}function Y(){document.activeElement=null}document.addEventListener("focus",S,true);document.addEventListener("blur",Y,true)}return{onReady:function(g){if(E)setTimeout(function(){g()},0);else D=g},_initialize:function(){H!=null&&B()},_initTimeout:function(){o()},register:function(g,p){if(!E){z=I=escape(g);Q=p}},initialize:function(g,p){if(!E){var n= | A()}}function n(){if(!u){var g=a(),o=history.length;O&&clearInterval(O);O=setInterval(function(){var p,s;p=a();s=history.length;if(p!==g){g=p;o=s;f(g);b()}else if(s!==o&&q){g=p;o=s;p=N[o-1];f(p);b()}},50)}}function E(){var g;g=L.value.split("|");if(g.length>1){I=g[0];y=g[1]}if(g.length>2)N=g[2].split(",");if(u)l();else{n();w=true;A!=null&&A()}}var q=false,u=false,H=false,A=null,F=null,L=null,w=false,O=null,N=[],I,y,S=function(){};if(!document.activeElement){function K(g){if(g&&g.target)document.activeElement= | E=false,R=null,A=[],I,z,Q=function(){};if(!document.activeElement){function S(g){if(g&&g.target)document.activeElement=g.target==document?null:g.target}function Y(){document.activeElement=null}document.addEventListener("focus",S,true);document.addEventListener("blur",Y,true)}return{onReady:function(g){if(E)setTimeout(function(){g()},0);else D=g},_initialize:function(){H!=null&&B()},_initTimeout:function(){o()},register:function(g,p){if(!E){z=I=escape(g);Q=p}},initialize:function(g,p){if(!E){var n= |
}else{v=w.startContainer;v=v.getChild(w.startOffset);if(v){if(x(v)===false)v=null;}else v=x(w.startContainer,true)===false?null:w.startContainer.getNextSourceNode(true,z,x);}while(v&&!this._.end){this.current=v;if(!this.evaluator||this.evaluator(v)!==false){if(!u)return v;}else if(u&&this.evaluator)return false;v=v[A](false,z,x);}this.end();return this.current=null;};function m(t){var u,v=null;while(u=l.call(this,t))v=u;return v;};d.walker=e.createClass({$:function(t){this.range=t;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,true);},checkForward:function(){return l.call(this,false,true)!==false;},checkBackward:function(){return l.call(this,true,true)!==false;},lastForward:function(){return m.call(this);},lastBackward:function(){return m.call(this,true);},reset:function(){delete this.current;this._={};}}});var n={block:1,'list-item':1,table:1,'table-row-group':1,'table-header-group':1,'table-footer-group':1,'table-row':1,'table-column-group':1,'table-column':1,'table-cell':1,'table-caption':1},o={hr:1};h.prototype.isBlockBoundary=function(t){var u=e.extend({},o,t||{});return n[this.getComputedStyle('display')]||u[this.getName()];};d.walker.blockBoundary=function(t){return function(u,v){return!(u.type==1&&u.isBlockBoundary(t));};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmarkContents=function(t){},d.walker.bookmark=function(t,u){function v(w){return w&&w.getName&&w.getName()=='span'&&w.hasAttribute('_fck_bookmark');};return function(w){var x,y;x=w&&!w.getName&&(y=w.getParent())&&v(y);x=t?x:x||v(w);return u^x;};};d.walker.whitespaces=function(t){return function(u){var v=u&&u.type==3&&!e.trim(u.getText());return t^v;};};d.walker.invisible=function(t){var u=d.walker.whitespaces();return function(v){var w=u(v)||v.is&&!v.$.offsetHeight;return t^w;};};var p=/^[\t\r\n ]*(?: |\xa0)$/,q=d.walker.whitespaces(true),r=d.walker.bookmark(false,true),s=function(t){return r(t)&&q(t);};h.prototype.getBogus=function(){var t=this.getLast(s);if(t&&(!c?t.is&&t.is('br'):t.getText&&p.test(t.getText())))return t;return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v){t.optimizeBookmark();var w=t.startContainer,x=t.endContainer,y=t.startOffset,z=t.endOffset,A,B; | for(var C=0;C<B.length;C++)a.document.appendStyleSheet(B[C]);}else{B=u(B,a.getUrl(m[p]));a.document.appendStyleText(B);}q.css=B;y=1;}if(!z){t(q.js);a.scriptLoader.load(q.js,function(){z=1;A();});}A();}};return{add:function(o,p){k[o]=p;p.skinPath=m[o]||(m[o]=a.getUrl('skins/'+o+'/'));},load:function(o,p,q){var r=o.skinName,s=o.skinPath;if(k[r])n(o,r,p,q);else{m[r]=s;a.scriptLoader.load(a.getUrl(s+'skin.js'),function(){n(o,r,p,q);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';var A=x.config;A.contentsLangDirection=='ui'&&(A.contentsLangDirection=x.lang.dir);s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}j.load(z.split(','),function(D){var E=[],F=[],G=[]; x.plugins=D;for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);if(!z.$.submit.nodeName)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var r=this;if(!l)r.updateElement();if(r.mode)r._.modes[r.mode].unload(r.getThemeSpace('contents'));r.theme.destroy(r);var m,n=0,o,p,q;if(r.toolbox){m=r.toolbox.toolbars;for(;n<m.length;n++){p=m[n].items;for(o=0;o<p.length;o++){q=p[o];if(q.clickFn)e.removeFunction(q.clickFn);if(q.keyDownFn)e.removeFunction(q.keyDownFn);if(q.index)k.button._.instances[q.index]=null;}}}if(r.contextMenu)e.removeFunction(r.contextMenu._.functionId);if(r._.filebrowserFn)e.removeFunction(r._.filebrowserFn);r.fire('destroy');a.remove(r);a.fire('instanceDestroyed',null,r);},execCommand:function(l,m){var n=this.getCommand(l),o={name:l,commandData:m,command:n}; | }else{v=w.startContainer;v=v.getChild(w.startOffset);if(v){if(x(v)===false)v=null;}else v=x(w.startContainer,true)===false?null:w.startContainer.getNextSourceNode(true,z,x);}while(v&&!this._.end){this.current=v;if(!this.evaluator||this.evaluator(v)!==false){if(!u)return v;}else if(u&&this.evaluator)return false;v=v[A](false,z,x);}this.end();return this.current=null;};function m(t){var u,v=null;while(u=l.call(this,t))v=u;return v;};d.walker=e.createClass({$:function(t){this.range=t;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,true);},checkForward:function(){return l.call(this,false,true)!==false;},checkBackward:function(){return l.call(this,true,true)!==false;},lastForward:function(){return m.call(this);},lastBackward:function(){return m.call(this,true);},reset:function(){delete this.current;this._={};}}});var n={block:1,'list-item':1,table:1,'table-row-group':1,'table-header-group':1,'table-footer-group':1,'table-row':1,'table-column-group':1,'table-column':1,'table-cell':1,'table-caption':1},o={hr:1};h.prototype.isBlockBoundary=function(t){var u=e.extend({},o,t||{});return n[this.getComputedStyle('display')]||u[this.getName()];};d.walker.blockBoundary=function(t){return function(u,v){return!(u.type==1&&u.isBlockBoundary(t));};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmarkContents=function(t){},d.walker.bookmark=function(t,u){function v(w){return w&&w.getName&&w.getName()=='span'&&w.hasAttribute('_fck_bookmark');};return function(w){var x,y;x=w&&!w.getName&&(y=w.getParent())&&v(y);x=t?x:x||v(w);return u^x;};};d.walker.whitespaces=function(t){return function(u){var v=u&&u.type==3&&!e.trim(u.getText());return t^v;};};d.walker.invisible=function(t){var u=d.walker.whitespaces();return function(v){var w=u(v)||v.is&&!v.$.offsetHeight;return t^w;};};var p=/^[\t\r\n ]*(?: |\xa0)$/,q=d.walker.whitespaces(true),r=d.walker.bookmark(false,true),s=function(t){return r(t)&&q(t);};h.prototype.getBogus=function(){var t=this.getLast(s);if(t&&(!c?t.is&&t.is('br'):t.getText&&p.test(t.getText())))return t;return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v){t.optimizeBookmark();var w=t.startContainer,x=t.endContainer,y=t.startOffset,z=t.endOffset,A,B; |
(function(x,v){function Y(){if(!d.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(Y,1);return}d.ready()}}function ra(a,b){b.src?d.ajax({url:b.src,async:false,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function S(a,b,e,g,h,k){var l=a.length;if(typeof b==="object"){for(var q in b)S(a,q,b[q],g,h,e);return a}if(e!==v){g=g&&d.isFunction(e);for(q=0;q<l;q++)h(a[q],b,g?e.call(a[q],q,h(a[q],b)):e,k);return a}return l? h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var g=d.data(a[e++]),h=d.data(this,g);if(g=g&&g.events){delete h.handle;h.events={};for(var k in g)for(var l in g[k])d.event.add(this,k,g[k][l],g[k][l].data)}}})}function aa(a,b,e){var g,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=d.fragments[a[0]])if(k!==1)g=k}if(!g){b=b&&b[0]?b[0].ownerDocument||b[0]:r; | (function(x,v){function Y(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(Y,1);return}c.ready()}}function ra(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function S(a,b,e,f,h,k){var l=a.length;if(typeof b==="object"){for(var q in b)S(a,q,b[q],f,h,e);return a}if(e!==v){f=f&&c.isFunction(e);for(q=0;q<l;q++)h(a[q],b,f?e.call(a[q],q,h(a[q],b)):e,k);return a}return l? h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var f=c.data(a[e++]),h=c.data(this,f);if(f=f&&f.events){delete h.handle;h.events={};for(var k in f)for(var l in f[k])c.event.add(this,k,f[k][l],f[k][l].data)}}})}function aa(a,b,e){var f,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=c.fragments[a[0]])if(k!==1)f=k}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r; | (function(x,v){function Y(){if(!d.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(Y,1);return}d.ready()}}function ra(a,b){b.src?d.ajax({url:b.src,async:false,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function S(a,b,e,g,h,k){var l=a.length;if(typeof b==="object"){for(var q in b)S(a,q,b[q],g,h,e);return a}if(e!==v){g=g&&d.isFunction(e);for(q=0;q<l;q++)h(a[q],b,g?e.call(a[q],q,h(a[q],b)):e,k);return a}return l?h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var g=d.data(a[e++]),h=d.data(this,g);if(g=g&&g.events){delete h.handle;h.events={};for(var k in g)for(var l in g[k])d.event.add(this,k,g[k][l],g[k][l].data)}}})}function aa(a,b,e){var g,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=d.fragments[a[0]])if(k!==1)g=k}if(!g){b=b&&b[0]?b[0].ownerDocument||b[0]:r; |
h = h.replace(/<(\/?)html(\/?)>/gi, ""); | save : function() { var e = pageDOM.get(s.id), h = t.getContent({save : true}); if (/TEXTAREA|INPUT/.test(e.nodeName)) e.value = h; else e.innerHTML = h; }, |
|
for (id in fields) { var field = fields[id], val = field.toValue(); if (val === null) { this.readVals = {}; | for (id in fields) if (fields[id].toValue() === null) | save: function () { var fields = this.fields; for (id in fields) { var field = fields[id], val = field.toValue(); if (val === null) { // invalid value encountered this.readVals = {}; return; } else if (field.settings.type != "button") this.readVals[id] = val; } this.write(); if (this.onSave) this.onSave(); // Call the save() callback function }, |
} else if (field.settings.type != "button") this.readVals[id] = val; } | save: function () { var fields = this.fields; for (id in fields) { var field = fields[id], val = field.toValue(); if (val === null) { // invalid value encountered this.readVals = {}; return; } else if (field.settings.type != "button") this.readVals[id] = val; } this.write(); if (this.onSave) this.onSave(); // Call the save() callback function }, |
|
$('paul_failed_tests').appendChild(new Element('option').update(fname)); | $('paul_failed_tests').appendChild(new Element('option').innerHTML = fname); | function saveCurrentToTest(){ var onSuccess = function(resp) { var arr = resp.responseText.split('/'); var fname = arr[arr.length-1]; fname = fname.split(' ')[0]; $('paul_failed_tests').appendChild(new Element('option').update(fname)); abc_contents_output[fname] = { abc: editArea.get(), out: "Unknown: reload page to see this data." }; }; var t = editArea.get(); new Ajax.Updater('ajax_status', '/tunes/save_test', {parameters: {abc: t, authenticity_token: window.authenticity_token}, onSuccess: onSuccess});} |
$this.updateStatusMessage(sprintf(_("Last saved at %1$s", ''+new Date()))); | $this.updateStatusMessage(sprintf(_("Last saved at %1$s"), ''+new Date())); | savePlugin: function () { if ($this.save_inprogress) { return; } $this.save_inprogress = true; $this.updateStatusMessage(sprintf(_("Saving at %1$s"), ''+new Date())); $this.updateDefinitionFromForm(); var json = $this.buildJSON(), url = $this.json_url; // Perform the actual save via POST. $.ajax({ type: 'POST', url: url, contentType: 'application/json', data: json, success: function () { $this.save_inprogress = false; $this.updateStatusMessage(sprintf(_("Last saved at %1$s", ''+new Date()))); }, error: function () { $this.save_inprogress = false; // TODO: More descriptive explanation of save failure. $this.updateStatusMessage(sprintf(_("Save failed at %1$s"), ''+new Date())); } }); }, |
beforeSend: function (req) { req.setRequestHeader('X-CSRF-Crumb', $this.csrf_crumb); }, | savePlugin: function () { if ($this.save_inprogress) { return; } $this.save_inprogress = true; $this.updateStatusMessage(sprintf(_("Saving at %1$s"), ''+new Date())); $this.updateDefinitionFromForm(); var errors = $('.field.error'); if (errors.length > 0) { $this.updateStatusMessage(_("Not saved: Validation errors detected and marked below")); $this.save_inprogress = false; return false; } var json = $this.buildJSON(), url = $this.json_url; // Perform the actual save via POST. $.ajax({ type: 'POST', url: url, contentType: 'application/json', data: json, success: function () { $this.save_inprogress = false; $this.updateStatusMessage(sprintf(_("Last saved at %1$s"), ''+new Date())); }, error: function () { $this.save_inprogress = false; // TODO: More descriptive explanation of save failure. $this.updateStatusMessage(sprintf(_("Save failed at %1$s"), ''+new Date())); } }); }, |
|
} if (document.getElementById('col_mpaa').checked) { result += detail.mpaa + '\t'; | function saveRating(detail) { var result = ''; if (document.getElementById('col_id').checked) { result += detail.id + '\t'; } if (document.getElementById('col_title').checked) { result += detail.title + '\t'; } if (document.getElementById('col_alttitle').checked) { result += (detail.alt ? detail.alt : '') + '\t'; } if (document.getElementById('col_year').checked) { result += detail.year + '\t'; } if (document.getElementById('col_mpaa').checked) { result += detail.mpaa + '\t'; } if (document.getElementById('col_genre').checked) { result += detail.genre + '\t'; } if (document.getElementById('col_rating').checked) { result += detail.rating + '\t'; } if (document.getElementById('col_imdb_id').checked) { result += (detail.imdb_id ? detail.imdb_id : '') + '\t'; } if (document.getElementById('col_imdb_title').checked) { result += (detail.imdb_title ? detail.imdb_title : '') + '\t'; } if (document.getElementById('col_imdb_year').checked) { result += (detail.imdb_year ? detail.imdb_year : '') + '\t'; } // Remove last tab. result = result.substring(0, result.length - 1); addOutput(result); } |
|
this.sorts.serialize(function(ele,pos){ if (ele.retrieve("order") != pos){ order.push(ele.retrieve("pid")+"|"+pos); ele.store("order", pos); | this.sorts.serialize(function(li,pos){ if (li == ele && ele.retrieve("order") != pos){ order.push(ele.retrieve("pid")+"|"+pos) | saveSort: function(ele, copy) { var order = []; this.sorts.serialize(function(ele,pos){ if (ele.retrieve("order") != pos){ order.push(ele.retrieve("pid")+"|"+pos); ele.store("order", pos); } }); if (order.length > 0){ indicateLoad(); new Request.JSON({ method: 'get', url: '/json/package_order/' + order[0], onSuccess: indicateFinish, onFailure: indicateFinish }).send(); } } |
if (window.WebSocket === undefined) | if (typeof window.WebSocket === 'undefined') | function scheduleUpdate() { _$_$if_WEB_SOCKETS_$_(); if (websocket.state != WebSocketsUnavailable) { if (window.WebSocket === undefined) websocket.state = WebSocketsUnavailable; else { var ws = websocket.socket; if ((ws == null || ws.readyState > 1)) { if (ws != null && websocket.state == WebSocketsUnknown) websocket.state = WebSocketsUnavailable; else { var query = url.substr(url.indexOf('?')); var wsurl = "ws" + location.protocol.substr(4) + "//" + location.hostname + ":" + location.port + location.pathname + query; websocket.socket = ws = new WebSocket(wsurl); ws.onmessage = function(event) { websocket.state = WebSocketsWorking; handleResponse(0, event.data, null); }; } } if (ws.readyState == 1) { sendUpdate(); return; } } } _$_$endif_$_(); if (responsePending != null && pollTimer != null) { clearTimeout(pollTimer); responsePending.abort(); responsePending = null; } if (responsePending == null) { if (updateTimeout == null) { updateTimeout = setTimeout(function() { sendUpdate(); }, WT.updateDelay); updateTimeoutStart = (new Date).getTime(); } else if (commErrors) { clearTimeout(updateTimeout); sendUpdate(); } else { var diff = (new Date).getTime() - updateTimeoutStart; if (diff > WT.updateDelay) { clearTimeout(updateTimeout); sendUpdate(); } } }} |
if (updateTimeout == null) | if (updateTimeout == null) { | function scheduleUpdate() { if (responsePending != null && pollTimer != null) { clearTimeout(pollTimer); responsePending.abort(); responsePending = null; } if (responsePending == null) { if (updateTimeout == null) updateTimeout = setTimeout(function() { sendUpdate(); }, WT.updateDelay); else if (commErrors) { clearTimeout(updateTimeout); sendUpdate(); } }} |
else if (commErrors) { | updateTimeoutStart = (new Date).getTime(); } else if (commErrors) { | function scheduleUpdate() { if (responsePending != null && pollTimer != null) { clearTimeout(pollTimer); responsePending.abort(); responsePending = null; } if (responsePending == null) { if (updateTimeout == null) updateTimeout = setTimeout(function() { sendUpdate(); }, WT.updateDelay); else if (commErrors) { clearTimeout(updateTimeout); sendUpdate(); } }} |
} else { var diff = (new Date).getTime() - updateTimeoutStart; if (diff > WT.updateDelay) { clearTimeout(updateTimeout); sendUpdate(); } | function scheduleUpdate() { if (responsePending != null && pollTimer != null) { clearTimeout(pollTimer); responsePending.abort(); responsePending = null; } if (responsePending == null) { if (updateTimeout == null) updateTimeout = setTimeout(function() { sendUpdate(); }, WT.updateDelay); else if (commErrors) { clearTimeout(updateTimeout); sendUpdate(); } }} |
|
tempPDF = newDoc.evaluate(' | var scrape = function(newDoc, set) { var PDF; var tempPDF = newDoc.evaluate('//a[@class="noul" and div/div[contains(text(), "PDF")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if (!tempPDF) { // PDF xpath failed, lets try another tempPDF = newDoc.evaluate('//a[@class="noul" and contains(text(), "PDF")]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if (!tempPDF) { // second PDF xpath failed set PDF to null to avoid item.attachments PDF = null; } else { PDF = tempPDF.href; // second xpath succeeded, use that link } } else { PDF = tempPDF.href; // first xpath succeeded, use that link } var url = newDoc.location.href; var get = newDoc.evaluate('//a[img[contains(@src, "exportarticle_a.gif")]]', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href; // if the PDF is available make it an attachment otherwise only use snapshot. var attachments; if (PDF) { attachments = [ {url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"}, {url:PDF, title:"ScienceDirect Full Text PDF", mimeType:"application/pdf"} // Sometimes PDF is null...I hope that is ok ]; } else { attachments = [ {url:url, title:"ScienceDirect Snapshot", mimeType:"text/html"} ]; } // This does not work, not sure why. //var doi = newDoc.evaluate('//a[contains(text(), "doi")]/text()', newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); //Zotero.debug(doi); //doi = doi.textContent.substr(4); // pass these values to the next function //set.doi = doi; set.url = url; set.get = get; set.attachments = attachments; return set; }; |
|
if (doc.evaluate(' newItem.date = doc.evaluate(' | if (doc.evaluate(' newItem.date = Zotero.Utilities.trim(doc.evaluate(' | function scrape(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == "x" ) return namespace; else return null; } : null; newItem = new Zotero.Item("magazineArticle"); newItem.ISSN = "0013-0613"; newItem.url = doc.location.href; newItem.publicationTitle = "The Economist"; //get headline var title = new Array(); if (doc.title && doc.title != "" && doc.title != "Economist.com") { title = doc.title.split(" | "); } else { title.push(doc.evaluate('//div[@class="clear"][@id="pay-barrier"]/div[@class="col-left"]/div[@class="article"]/font/b', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); } if (title.length == 1) { title.push = title; } else { title = title.slice(0, title.length - 1); title = title.join(": "); } newItem.title = title; if (doc.evaluate('//div[@class="clear"][@id="pay-barrier"]/div[@class="col-right"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext() ) { newItem.extra = "(Subscription only)"; } //get abstract if (doc.evaluate('//div[@id="content"]/div[@class="clear top-border"]/div[@class="col-left"]/h2', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext() ) { newItem.abstractNote = doc.evaluate('//div[@id="content"]/div[@class="clear top-border"]/div[@class="col-left"]/h2', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; } else if (doc.evaluate('//div[@class="clear"][@id="pay-barrier"]/div[@class="col-left"]/div[@class="article"]/p/strong', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext() ) { newItem.abstractNote = doc.evaluate('//div[@class="clear"][@id="pay-barrier"]/div[@class="col-left"]/div[@class="article"]/p/strong', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; } else if (doc.evaluate('//div[@id="content"]/div[@class="clear top-border"]/div[@class="col-left"]/p[3]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { newItem.abstractNote = doc.evaluate('//div[@id="content"]/div[@class="clear top-border"]/div[@class="col-left"]/p[3]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; } if (newItem.abstractNote) newItem.abstractNote = Zotero.Utilities.trimInternal(newItem.abstractNote); //get date and extra stuff if (doc.evaluate('//div[@class="col-left"]/p[@class="info"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext() ) { newItem.date = doc.evaluate('//div[@class="col-left"]/p[@class="info"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent.substr(0,13); } var url = doc.location.href; newItem.attachments = [ {url:url.replace("displaystory", "PrinterFriendly"), title:"The Economist Snapshot", mimeType:"text/html"} ]; newItem.complete();} |
var author = Zotero.Utilities.cleanString(metaTags["byl"]); | var author = Zotero.Utilities.trimInternal(metaTags["byl"]); | function scrape(doc, url) { var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The New York Times"; newItem.ISSN = "0362-4331"; var metaTags = new Object(); if(url != undefined) { newItem.url = url; var metaTagRe = /<meta[^>]*>/gi; var nameRe = /name="([^"]+)"/i; var contentRe = /content="([^"]+)"/i; var m = doc.match(metaTagRe); if(!m) { return; } for(var i=0; i<m.length; i++) { var name = nameRe.exec(m[i]); var content = contentRe.exec(m[i]); if(name && content) { metaTags[name[1]] = content[1]; } } if(!metaTags["hdl"]) { return; } newItem.attachments.push({url:url, title:"New York Times Snapshot", mimeType:"text/html"}); } else { newItem.url = doc.location.href; var metaTagHTML = doc.getElementsByTagName("meta"); for(var i=0; i<metaTagHTML.length; i++) { var key = metaTagHTML[i].getAttribute("name"); var value = metaTagHTML[i].getAttribute("content"); if(key && value) { metaTags[key] = value; } } newItem.attachments.push({document:doc, title:"New York Times Snapshot"}); } associateMeta(newItem, metaTags, "dat", "date"); associateMeta(newItem, metaTags, "hdl", "title"); associateMeta(newItem, metaTags, "dsk", "section"); associateMeta(newItem, metaTags, "articleid", "accessionNumber"); if(metaTags["byl"]) { var author = Zotero.Utilities.cleanString(metaTags["byl"]); if(author.substr(0, 3).toLowerCase() == "by ") { author = author.substr(3); } var authors = author.split(" and "); for each(var author in authors) { // fix capitalization var words = author.split(" "); for(var i in words) { words[i] = words[i][0].toUpperCase()+words[i].substr(1).toLowerCase(); } author = words.join(" "); if(words[0] == "The") { newItem.creators.push({lastName:author, creatorType:"author", fieldMode:true}); } else { newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } } if(metaTags["keywords"]) { var keywords = metaTags["keywords"]; newItem.tags = keywords.split(","); for(var i in newItem.tags) { newItem.tags[i] = newItem.tags[i].replace(" ", ", "); } } newItem.complete();} |
tmpTitle = Zotero.Utilities.cleanString(tmpTitle); | tmpTitle = Zotero.Utilities.trimInternal(tmpTitle); | function scrape(doc) { var newItem = new Zotero.Item("patent"); newItem.url = doc.location.href; var extraText = new String(); var tmpStr = new String(); var tmpRefs = ""; var tmpTitle = doc.title; var fontTags = doc.getElementsByTagName("font"); for(var i=0; i<fontTags.length; i++) { if (fontTags[i].getAttribute("size") == "+1") { tmpTitle = tmpTitle + " - " + fontTags[i].innerHTML; } } tmpTitle = Zotero.Utilities.cleanString(tmpTitle); tmpTitle = tmpTitle.replace(/<[^>]+>/g, ""); newItem.title = tmpTitle; var cellTags = doc.getElementsByTagName("td"); for(var i=0; i<cellTags.length; i++) { var s = new String(cellTags[i].innerHTML); if (s.indexOf("United States Patent") > -1) { tmpStr = cellTags[i+1].childNodes[0].innerHTML; tmpStr = tmpStr.replace(/<[^>]+>/gi, ""); tmpStr = tmpStr.replace(/,/gi, ""); newItem.patentNumber = tmpStr; tmpStr = cellTags[i+3].innerHTML; tmpStr = tmpStr.replace(/<[^>]+>/gi, ""); newItem.issueDate = tmpStr; continue; } if (s.indexOf("Assignee") > -1) { tmpStr = cellTags[i+1].innerHTML; tmpStr = tmpStr.replace(/<\/?\w+>/gi, ""); newItem.assignee = tmpStr; continue; } if (s.indexOf("Inventors") > -1) { tmpStr = cellTags[i+1].innerHTML; var inventors = tmpStr.split(/<b>,/ig); for (var j=0; j<inventors.length; j++) { var tmpInventor = inventors[j]; tmpInventor = tmpInventor.replace(/<\/?\w+>/gi, ""); tmpInventor = tmpInventor.replace(/\([^\)]+\)/gi, ""); tmpInventor = tmpInventor.replace(/^\s+/gi, ""); var names = tmpInventor.split(";"); if (names) { var lname = names[0]; var fname = names[1]; lname = lname.replace(/^\s+/gi, ""); lname = lname.replace(/\s+$/gi, ""); fname= fname.replace(/^\s+/gi, ""); fname= fname.replace(/\s+$/gi, ""); newItem.creators.push({lastName:lname, firstName:fname, creatorType:"inventor"}); } } continue; } // references if (s.indexOf("<a href=\"/netacgi/nph-Parser?Sect2") > -1) { tmpRefs = tmpRefs + cellTags[i].childNodes[0].innerHTML + " "; } if (s.indexOf("<a href=\"http://appft1.uspto.gov/netacgi/nph-Parser?TERM1") > -1) { tmpRefs = tmpRefs + cellTags[i].childNodes[0].innerHTML + " "; } } var centerTags = doc.getElementsByTagName("center"); for(var i=0; i<centerTags.length; i++) { var s = new String(centerTags[i].innerHTML); if (s.indexOf("Abstract") > -1) { //newItem.extra = "ok"; var el = get_nextsibling(centerTags[i]); newItem.abstractNote = el.innerHTML; } } newItem.references = tmpRefs; newItem.complete();} |
newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); | newItem.tags.push(Zotero.Utilities.trimInternal(tags[j])); | function scrape (doc){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var url = doc.location.href; var newItem = new Zotero.Item("encyclopediaArticle"); var xpath = '/html/body/div[@class="text"]/font'; var titleElmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if (titleElmt) { var title = titleElmt.textContent; } else { xpath = '/html/body/div[@class="text"]/b'; var title = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; } newItem.title = title; newItem.encyclopediaTitle = "Encyclopédie, ou Dictionnaire raisonné des sciences, des arts et des métiers"; newItem.shortTitle = "Encyclopédie"; newItem.date = "1751-1772"; newItem.publisher = "Briasson"; newItem.place = "Paris"; newItem.url = url; newItem.attachments.push({title:"ARTFL Snapshot", mimeType:"text/html", url:url, snapshot:true}); // get author and tags var hostRegexp = new RegExp("^(https?://[^/]+)/"); var hMatch = hostRegexp.exec(url); var host = hMatch[1]; var getString1 = "/cgi-bin/philologic31/search3t?dbname=encyclopedie0507&word=&dgdivhead="; var getString2 = "&dgdivocauthor=&dgdivocplacename=&dgdivocsalutation=&dgdivocclassification=&dgdivocpartofspeech=&dgdivtype=&CONJUNCT=PHRASE&DISTANCE=3&PROXY=or+fewer&OUTPUT=conc&POLESPAN=5&KWSS=1&KWSSPRLIM=500"; Zotero.Utilities.HTTP.doGet(host+getString1+title+getString2, function(text){ var tagRe = new RegExp('>'+title+'</a>[^\[]*\\[([^\\]]*)\]', 'i'); var m = tagRe.exec(text); if(m[1] != "unclassified"){ var tagstring = m[1].replace("&", "&", "g"); var tags = tagstring.split(";") for(var j in tags) { newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); } } var authorRe = new RegExp('>'+title+'</a>,([^,]*),', "i"); var m = authorRe.exec(text); var author = m[1]; author = Zotero.Utilities.cleanString(author); // reconcile author author = reconcileAuthor(author); if (author!="NA"){ // ignore unknown authors newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true)); } newItem.creators.push({firstName:"Denis", lastName:"Diderot", creatorType:"editor"}); newItem.creators.push({firstName:"Jean le Rond", lastName:"d'Alembert", creatorType:"editor"}); newItem.complete(); }, function() {Zotero.done();}, null); Zotero.wait(); } |
author = Zotero.Utilities.cleanString(author); | author = Zotero.Utilities.trimInternal(author); | function scrape (doc){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var url = doc.location.href; var newItem = new Zotero.Item("encyclopediaArticle"); var xpath = '/html/body/div[@class="text"]/font'; var titleElmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if (titleElmt) { var title = titleElmt.textContent; } else { xpath = '/html/body/div[@class="text"]/b'; var title = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; } newItem.title = title; newItem.encyclopediaTitle = "Encyclopédie, ou Dictionnaire raisonné des sciences, des arts et des métiers"; newItem.shortTitle = "Encyclopédie"; newItem.date = "1751-1772"; newItem.publisher = "Briasson"; newItem.place = "Paris"; newItem.url = url; newItem.attachments.push({title:"ARTFL Snapshot", mimeType:"text/html", url:url, snapshot:true}); // get author and tags var hostRegexp = new RegExp("^(https?://[^/]+)/"); var hMatch = hostRegexp.exec(url); var host = hMatch[1]; var getString1 = "/cgi-bin/philologic31/search3t?dbname=encyclopedie0507&word=&dgdivhead="; var getString2 = "&dgdivocauthor=&dgdivocplacename=&dgdivocsalutation=&dgdivocclassification=&dgdivocpartofspeech=&dgdivtype=&CONJUNCT=PHRASE&DISTANCE=3&PROXY=or+fewer&OUTPUT=conc&POLESPAN=5&KWSS=1&KWSSPRLIM=500"; Zotero.Utilities.HTTP.doGet(host+getString1+title+getString2, function(text){ var tagRe = new RegExp('>'+title+'</a>[^\[]*\\[([^\\]]*)\]', 'i'); var m = tagRe.exec(text); if(m[1] != "unclassified"){ var tagstring = m[1].replace("&", "&", "g"); var tags = tagstring.split(";") for(var j in tags) { newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); } } var authorRe = new RegExp('>'+title+'</a>,([^,]*),', "i"); var m = authorRe.exec(text); var author = m[1]; author = Zotero.Utilities.cleanString(author); // reconcile author author = reconcileAuthor(author); if (author!="NA"){ // ignore unknown authors newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author", true)); } newItem.creators.push({firstName:"Denis", lastName:"Diderot", creatorType:"editor"}); newItem.creators.push({firstName:"Jean le Rond", lastName:"d'Alembert", creatorType:"editor"}); newItem.complete(); }, function() {Zotero.done();}, null); Zotero.wait(); } |
var author = Zotero.Utilities.cleanString(metaTags["Authors"]); | var author = Zotero.Utilities.trimInternal(metaTags["Authors"]); | function scrape(doc, url) { var newItem = new Zotero.Item("magazineArticle"); if(url&&url.indexOf("blogs.edweek.org")>-1) {newItem.itemType="blogPost";} newItem.url = doc.location.href; var metaTags = new Object(); var metaTagHTML = doc.getElementsByTagName("meta"); var i; for (i = 0 ; i < metaTagHTML.length ; i++) { metaTags[metaTagHTML[i].getAttribute("name")]=Zotero.Utilities.cleanTags(metaTagHTML[i].getAttribute("content")); } associateMeta(newItem, metaTags, "Title", "title"); associateMeta(newItem, metaTags, "Cover_date", "date"); associateMeta(newItem, metaTags, "Description", "abstractNote"); associateMeta(newItem, metaTags, "ArticleID", "accessionNumber"); associateMeta(newItem,metaTags,"Source","publicationTitle"); if (metaTags["Authors"]) { var author = Zotero.Utilities.cleanString(metaTags["Authors"]); if (author.substr(0,3).toLowerCase() == "by ") { author = author.substr(3); } var authors = author.split(" and "); for each(var author in authors) { var words = author.split(" "); for (var i in words) { words[i] = words[i][0].toUpperCase() +words[i].substr(1).toLowerCase(); } author = words.join(" "); newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } newItem.complete();} |
var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var title = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var abstract = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var applicantField = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var anumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var pnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var CIBnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var tmpECLAnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var prnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var date = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | var inventorField = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); | function scrape(doc,url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; //Get title var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); var title1 = title.split(" "); for (var j in title1) { title1[j] = title1[j][0].toUpperCase() + title1[j].substr(1).toLowerCase(); } title = title1.join(" "); } //Get Abstract var xpath = '//td[@id="abCell"]'; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Applicant var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get application number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get patent number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get CIB var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get ECLA var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); tmpECLAnumber = tmpECLAnumber.substr(24); tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; '); var aus = tmpECLAnumber.split("; "); var ECLAnumber = ""; for (var i=0; i< aus.length/2 ; i++){ ECLAnumber = ECLAnumber + aus[i] + "; " } } //Get priority number var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get date var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Get Creators var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]"; if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){ var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); } //Create Zotero Ref var newArticle = new Zotero.Item('patent'); newArticle.url = doc.location.href; newArticle.title = title; newArticle.date = date; newArticle.abstractNote = abstract; newArticle.patentNumber = pnumber; newArticle.priorityNumbers = prnumber; newArticle.applicationNumber = anumber; newArticle.extra = "CIB: " + CIBnumber + "\nECLA: " + ECLAnumber if (applicantField) { var applicant = reorganizeNames(applicantField).join("; "); newArticle.assignee = applicant; } var inventors = reorganizeNames(inventorField); for (var m = 0; m< inventors.length; m++) { newArticle.creators.push(Zotero.Utilities.cleanAuthor(inventors[m], "inventor", true)); } newArticle.complete();} |
var note = Zotero.Utilities.cleanString( | var note = Zotero.Utilities.trimInternal( | function scrape (doc) { var n = doc.documentElement.namespaceURI; var ns = n ? function(prefix) { if (prefix == 'x') return n; else return null; } : null; var datablock = doc.evaluate('//td[@align="right" and @width="100%" and @valign="top"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext(); var tableLabels = doc.evaluate('./table/tbody/tr[1]/td[@bgcolor="#dddddd"][1]|./table//table[1]//tr[1]/td[@bgcolor="#dddddd"][1]', datablock, ns, XPathResult.ANY_TYPE, null); var titleBlock, authorBlock, publicationBlock, metaBlock, codeBlock, keywordBlock, abstractBlock, referenceBlock; var t = 0, label; // Table number and label while ((label = tableLabels.iterateNext()) !== null) { t++; label = label.textContent; switch (label) { case "Названиепубликации": titleBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Авторы": authorBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Журнал": metaBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Коды": codeBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Ключевыеслова": keywordBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Аннотация": abstractBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Коды": codeBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Списоклитературы": referenceBlock = doc.evaluate('./table['+t+']', datablock, ns, XPathResult.ANY_TYPE, null).iterateNext(); break; case "Переводнаяверсия": default: Zotero.debug("Unknown/unsupported block: "+ label); break; } } var type = doc.evaluate('.//table[2]//tr[5]/td[4]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; switch (type) { case "научная статья": type = "journalArticle"; break; case "учебное пособие": case "монография": type = "book"; break; default: Zotero.debug("Unknown type: "+type+". Using 'journalArticle'"); type = "journalArticle"; break; } var item = new Zotero.Item(type); /*var pdf = false; // Now see if we have a free PDF to download var pdfImage = doc.evaluate('//a/img[@src="/images/pdf_green.gif"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext(); if (pdfImage) { // A green PDF is a free one. We need to construct the POST request var postData = [], postField; var postNode = doc.evaluate('//form[@name="results"]/input', doc, ns, XPathResult.ANY_TYPE, null); while ((postField = postNode.iterateNext()) !== null) { postData.push(postField.name + "=" +postField.value); } postData = postData.join("&"); Zotero.debug(postData + postNode.iterateNext()); Zotero.Utilities.HTTP.doPost('http://elibrary.ru/full_text.asp', postData, function(text) { var href = text.match(/http:\/\/elibrary.ru\/download\/.*?\.pdf/)[0]; pdf = {url:href, title:"eLibrary.ru полный текст", mimeType:"application/pdf"}; }); }*/ item.title = doc.title.match(/eLIBRARY.RU - (.*)/)[1]; if (authorBlock) { var authorNode = doc.evaluate('.//td[2]/font/a', authorBlock, ns, XPathResult.ANY_TYPE, null); while ((author = authorNode.iterateNext()) !== null) { if (!author.href.match(/org_about\.asp/)) { // Remove organizations author = author.textContent; var authors = author.split(","); for (var i = 0; i < authors.length; i++) { var cleaned = Zotero.Utilities.cleanAuthor(authors[i], "author"); // If we have only one name, set the author to one-name mode if (cleaned.firstName == "") { cleaned["fieldMode"] = true; } else { // We can check for all lower-case and capitalize if necessary // All-uppercase is handled by cleanAuthor cleaned.firstName = (cleaned.firstName == cleaned.firstName.toLowerCase()) ? Zotero.Utilities.capitalizeTitle(cleaned.firstName, true) : cleaned.firstName; cleaned.lastName = (cleaned.lastName == cleaned.lastName.toLowerCase()) ? Zotero.Utilities.capitalizeTitle(cleaned.lastName, true) : cleaned.lastName; } // Skip entries with an @ sign-- email addresses slip in otherwise if (cleaned.lastName.indexOf("@") === -1) item.creators.push(cleaned); } } else { Zotero.debug("Skipping presumed affiliation: " + author.textContent) ; } } } item.publicationTitle = doc.evaluate('.//table[1]//tr[1]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.publisher = doc.evaluate('.//table[1]//tr[2]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.date = doc.evaluate('.//table[2]//tr[1]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.ISSN = doc.evaluate('.//table[2]//tr[1]/td[4]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.volume = doc.evaluate('.//table[2]//tr[2]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.issue = doc.evaluate('.//table[2]//tr[3]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.pages = doc.evaluate('.//table[2]//tr[4]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; item.language = doc.evaluate('.//table[2]//tr[5]/td[2]', metaBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; if (abstractBlock) item.abstractNote = doc.evaluate('./tbody/tr/td[2]/table/tbody/tr/td/font', abstractBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; /*if (referenceBlock) { var note = Zotero.Utilities.cleanString( doc.evaluate('./tbody/tr/td[2]/table', referenceBlock, ns, XPathResult.ANY_TYPE, null) .iterateNext().textContent); Zotero.debug(note); item.notes.push(note); }*/ if (codeBlock) { item.extra = doc.evaluate('.//td[2]', codeBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent; var doi = item.extra.match(/DOI: (10\..+?) /); if (doi) item.DOI = doi[1]; } if (keywordBlock) { var tag, tagNode = doc.evaluate('.//td[2]/a', keywordBlock, ns, XPathResult.ANY_TYPE, null); while ((tag = tagNode.iterateNext()) !== null) item.tags.push(tag.textContent); } //if(pdf) item.attachments.push(pdf); item.complete();} |
var author = Zotero.Utilities.cleanString(metaTags["Author"]); | var author = Zotero.Utilities.trimInternal(metaTags["Author"]); | function scrape(doc, url) { var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The International Herald Tribune"; newItem.ISSN = "0294-8052"; newItem.url = doc.location.href; var metaTags = new Object(); var metaTagHTML = doc.getElementsByTagName("meta"); for (var i = 0 ; i < metaTagHTML.length ; i++) { metaTags[metaTagHTML[i].getAttribute("name")] = Zotero.Utilities.cleanTags(metaTagHTML[i].getAttribute("content")); } associateMeta(newItem, metaTags, "Headline", "title"); associateMeta(newItem, metaTags, "PrintPubDate", "date"); associateMeta(newItem, metaTags, "Summary", "abstractNote"); associateMeta(newItem, metaTags, "ArticleID", "accessionNumber"); associateMeta(newItem, metaTags, "Owner", "extra"); if (metaTags["Author"]) { var author = Zotero.Utilities.cleanString(metaTags["Author"]); if (author.substr(0,3).toLowerCase() == "by ") { author = author.substr(3); } var authors = author.split(" and "); for each(var author in authors) { var words = author.split(" "); for (var i in words) { words[i] = words[i][0].toUpperCase() + words[i].substr(1).toLowerCase(); } author = words.join(" "); newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } if (metaTags["keywords"]) { var keywords = metaTags["keywords"]; newItem.tags = keywords.split(","); if (newItem.tags[0].toLowerCase()) { newItem.tags = newItem.tags.slice(1, newItem.tags.length); } Zotero.debug(newItem.tags); for (var i in newItem.tags) { if (newItem.tags[i] != "") { newItem.tags[i] = Zotero.Utilities.cleanString(newItem.tags[i].replace(" ", ", ")); var words = newItem.tags[i].split(" "); for (var j = 0 ; j < words.length ; j++) { if (words[j][0] == words[j][0].toLowerCase()) { words[j] = words[j][0].toUpperCase() + words[j].substr(1).toLowerCase(); } } newItem.tags[i] = words.join(" "); } } } newItem.complete();} |
newItem.tags[i] = Zotero.Utilities.cleanString(newItem.tags[i].replace(" ", ", ")); | newItem.tags[i] = Zotero.Utilities.trimInternal(newItem.tags[i].replace(" ", ", ")); | function scrape(doc, url) { var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The International Herald Tribune"; newItem.ISSN = "0294-8052"; newItem.url = doc.location.href; var metaTags = new Object(); var metaTagHTML = doc.getElementsByTagName("meta"); for (var i = 0 ; i < metaTagHTML.length ; i++) { metaTags[metaTagHTML[i].getAttribute("name")] = Zotero.Utilities.cleanTags(metaTagHTML[i].getAttribute("content")); } associateMeta(newItem, metaTags, "Headline", "title"); associateMeta(newItem, metaTags, "PrintPubDate", "date"); associateMeta(newItem, metaTags, "Summary", "abstractNote"); associateMeta(newItem, metaTags, "ArticleID", "accessionNumber"); associateMeta(newItem, metaTags, "Owner", "extra"); if (metaTags["Author"]) { var author = Zotero.Utilities.cleanString(metaTags["Author"]); if (author.substr(0,3).toLowerCase() == "by ") { author = author.substr(3); } var authors = author.split(" and "); for each(var author in authors) { var words = author.split(" "); for (var i in words) { words[i] = words[i][0].toUpperCase() + words[i].substr(1).toLowerCase(); } author = words.join(" "); newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } if (metaTags["keywords"]) { var keywords = metaTags["keywords"]; newItem.tags = keywords.split(","); if (newItem.tags[0].toLowerCase()) { newItem.tags = newItem.tags.slice(1, newItem.tags.length); } Zotero.debug(newItem.tags); for (var i in newItem.tags) { if (newItem.tags[i] != "") { newItem.tags[i] = Zotero.Utilities.cleanString(newItem.tags[i].replace(" ", ", ")); var words = newItem.tags[i].split(" "); for (var j = 0 ; j < words.length ; j++) { if (words[j][0] == words[j][0].toLowerCase()) { words[j] = words[j][0].toUpperCase() + words[j].substr(1).toLowerCase(); } } newItem.tags[i] = words.join(" "); } } } newItem.complete();} |
temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; | temp=Zotero.Utilities.trimInternal(temp.textContent).split(" ");; | function scrape(doc,url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem=new Zotero.Item("journalArticle"); var temp; var xpath; var row; var rows; newItem.url = doc.location.href; xpath='//p[@id="title"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.title=temp.textContent;} xpath='//span[@id="published"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; newItem.date=temp[1]+" "+temp[0]+", "+temp[2]; } xpath='//p[@class="author"]'; rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var count=0; while(row=rows.iterateNext()) {newItem.creators.push(Zotero.Utilities.cleanAuthor(row.textContent,"author")); count++;} xpath='//tr/td/p'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var temp2=temp.iterateNext(); if(temp2) { for(var n=0;n<(3+2*count);n++) {temp2=temp.iterateNext();} newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); } xpath='//p[@id="runhead"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); newItem.publicationTitle=fixCaps(temp[0]); for(var n=1;temp[n];n++) { if(temp[n].indexOf("VOL")>-1) {newItem.volume=temp[n].replace('VOL. ','');} else if(temp[n].indexOf("NO.")>-1) {newItem.issue=temp[n].replace('NO. ','');} else if(temp[n].indexOf("doi:")>-1) {newItem.DOI=temp[n].replace('doi:','');} else if(temp[n+1]) {newItem.pages=temp[n];} } } xpath='//p[@id="keywords"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); newItem.tags=temp.replace('.','').split('; '); } xpath='//p[@id="citation"]/span[@id="journal"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.journalAbbreviation=temp.textContent;} newItem.complete();} |
newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); | newItem.abstractNote=Zotero.Utilities.trimInternal(temp2.textContent); | function scrape(doc,url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem=new Zotero.Item("journalArticle"); var temp; var xpath; var row; var rows; newItem.url = doc.location.href; xpath='//p[@id="title"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.title=temp.textContent;} xpath='//span[@id="published"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; newItem.date=temp[1]+" "+temp[0]+", "+temp[2]; } xpath='//p[@class="author"]'; rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var count=0; while(row=rows.iterateNext()) {newItem.creators.push(Zotero.Utilities.cleanAuthor(row.textContent,"author")); count++;} xpath='//tr/td/p'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var temp2=temp.iterateNext(); if(temp2) { for(var n=0;n<(3+2*count);n++) {temp2=temp.iterateNext();} newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); } xpath='//p[@id="runhead"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); newItem.publicationTitle=fixCaps(temp[0]); for(var n=1;temp[n];n++) { if(temp[n].indexOf("VOL")>-1) {newItem.volume=temp[n].replace('VOL. ','');} else if(temp[n].indexOf("NO.")>-1) {newItem.issue=temp[n].replace('NO. ','');} else if(temp[n].indexOf("doi:")>-1) {newItem.DOI=temp[n].replace('doi:','');} else if(temp[n+1]) {newItem.pages=temp[n];} } } xpath='//p[@id="keywords"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); newItem.tags=temp.replace('.','').split('; '); } xpath='//p[@id="citation"]/span[@id="journal"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.journalAbbreviation=temp.textContent;} newItem.complete();} |
temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); | temp=Zotero.Utilities.trimInternal(temp.textContent).split(", "); | function scrape(doc,url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem=new Zotero.Item("journalArticle"); var temp; var xpath; var row; var rows; newItem.url = doc.location.href; xpath='//p[@id="title"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.title=temp.textContent;} xpath='//span[@id="published"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; newItem.date=temp[1]+" "+temp[0]+", "+temp[2]; } xpath='//p[@class="author"]'; rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var count=0; while(row=rows.iterateNext()) {newItem.creators.push(Zotero.Utilities.cleanAuthor(row.textContent,"author")); count++;} xpath='//tr/td/p'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var temp2=temp.iterateNext(); if(temp2) { for(var n=0;n<(3+2*count);n++) {temp2=temp.iterateNext();} newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); } xpath='//p[@id="runhead"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); newItem.publicationTitle=fixCaps(temp[0]); for(var n=1;temp[n];n++) { if(temp[n].indexOf("VOL")>-1) {newItem.volume=temp[n].replace('VOL. ','');} else if(temp[n].indexOf("NO.")>-1) {newItem.issue=temp[n].replace('NO. ','');} else if(temp[n].indexOf("doi:")>-1) {newItem.DOI=temp[n].replace('doi:','');} else if(temp[n+1]) {newItem.pages=temp[n];} } } xpath='//p[@id="keywords"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); newItem.tags=temp.replace('.','').split('; '); } xpath='//p[@id="citation"]/span[@id="journal"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.journalAbbreviation=temp.textContent;} newItem.complete();} |
temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); | temp=Zotero.Utilities.trimInternal(temp.textContent.replace('Keywords:','')); | function scrape(doc,url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem=new Zotero.Item("journalArticle"); var temp; var xpath; var row; var rows; newItem.url = doc.location.href; xpath='//p[@id="title"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.title=temp.textContent;} xpath='//span[@id="published"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; newItem.date=temp[1]+" "+temp[0]+", "+temp[2]; } xpath='//p[@class="author"]'; rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var count=0; while(row=rows.iterateNext()) {newItem.creators.push(Zotero.Utilities.cleanAuthor(row.textContent,"author")); count++;} xpath='//tr/td/p'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var temp2=temp.iterateNext(); if(temp2) { for(var n=0;n<(3+2*count);n++) {temp2=temp.iterateNext();} newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); } xpath='//p[@id="runhead"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); newItem.publicationTitle=fixCaps(temp[0]); for(var n=1;temp[n];n++) { if(temp[n].indexOf("VOL")>-1) {newItem.volume=temp[n].replace('VOL. ','');} else if(temp[n].indexOf("NO.")>-1) {newItem.issue=temp[n].replace('NO. ','');} else if(temp[n].indexOf("doi:")>-1) {newItem.DOI=temp[n].replace('doi:','');} else if(temp[n+1]) {newItem.pages=temp[n];} } } xpath='//p[@id="keywords"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); newItem.tags=temp.replace('.','').split('; '); } xpath='//p[@id="citation"]/span[@id="journal"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) {newItem.journalAbbreviation=temp.textContent;} newItem.complete();} |
Zotero.debug(Zotero.Utilities.cleanString(font.nodeValue)); | Zotero.debug(Zotero.Utilities.trimInternal(font.nodeValue)); | function scrape(doc) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem = new Zotero.Item("newspaperArticle"); newItem.publicationTitle = "The Washington Post"; newItem.ISSN = "0740-5421"; newItem.url = doc.location.href; var metaTags = doc.getElementsByTagName("meta"); // Elena's code to grab print version (all pages) snapshotURL=doc.location.href.replace(".html", "_pf.html"); newItem.attachments.push({title:"Washington Post Snapshot", mimeType:"text/html", url:snapshotURL, snapshot:true}); // grab title from doc title newItem.title = doc.title.replace(" - washingtonpost.com", ""); var byline = doc.evaluate('//div[@id="byline"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); // grab authors from byline if(byline) { var authors = byline.textContent.substr(3).split(" and "); for each(var author in authors) { newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); } } var fonts = doc.evaluate('//div[@id="article"]/p/font/text()', doc, nsResolver, XPathResult.ANY_TYPE, null); var font; while(font = fonts.iterateNext()) { var pageRe = /([^;]+);(?:[\xA0 ]+Pages?[\xA0 ]+([A-Z0-9\-]+))?/ // grab pages and date Zotero.debug(Zotero.Utilities.cleanString(font.nodeValue)); var m = pageRe.exec(font.nodeValue); if(m) { newItem.date = m[1]; newItem.pages = m[2]; break; } } // grab tags from meta tag var keywords = doc.getElementsByTagName("meta"); if(keywords) { keywords = keywords.namedItem("keywords"); if(keywords) { keywords = keywords.getAttribute("content"); if(keywords) { newItem.tags = keywords.split(/, ?/); } } } newItem.complete();} |
info = Zotero.Utilities.cleanString(info.textContent); | info = Zotero.Utilities.trimInternal(info.textContent); | function scrape(doc) { var newItem = new Zotero.Item("journalArticle"); newItem.publicationTitle = "The New York Review of Books"; newItem.ISSN = "0028-7504"; var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; newItem.url = doc.location.href; var metaTags = doc.getElementsByTagName("meta"); newItem.attachments.push({document:doc, title:"New York Review of Books Snapshot"}); associateMeta(newItem, metaTags, "dc.title", "title"); var info = doc.evaluate('//div[@id="center-content"]/h4[@class="date"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(info) { // get date (which is in an a tag) newItem.date = doc.evaluate("./a", info, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(newItem.date) { newItem.date = newItem.date.textContent; } info = Zotero.Utilities.cleanString(info.textContent); // get volume and issue var infoRe = /Volume ([0-9]+), Number ([0-9]+)/; var m = infoRe.exec(info); if(m) { newItem.volume = m[1]; newItem.issue = m[2]; } } var authors = doc.evaluate('//div[@id="center-content"]/h4/a[substring(@href, 1, 9) = "/authors/"]', doc, nsResolver, XPathResult.ANY_TYPE, null); var author; while(author = authors.iterateNext()) { newItem.creators.push(Zotero.Utilities.cleanAuthor(author.textContent, "author", false)); } newItem.complete();} |
abstract = Zotero.Utilities.cleanString(abstract); | abstract = Zotero.Utilities.trimInternal(abstract); | function scrape(doc){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var newItem = new Zotero.Item("document"); var xpath = '//title'; var title = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; title = Zotero.Utilities.trimInternal(title); title = title.substring(0, title.indexOf(" Recipe at Epicurious.com")); newItem.title = title; var elmt; xpath = '//p[@class="source"]'; var elmts = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); if (elmt = elmts.iterateNext()){ var authordate = elmt.textContent; var authordates = authordate.split("|"); newItem.creators.push(Zotero.Utilities.cleanAuthor(authordates[0], "contributor", true)); var datestring = authordates[1].toString(); datestring = datestring.replace("Copyright", ""); newItem.date = Zotero.Utilities.formatDate(Zotero.Utilities.strToDate(datestring)); while (elmt = elmts.iterateNext()){ Zotero.debug("looping?"); Zotero.debug(elmt.textContent); newItem.creators.push(Zotero.Utilities.cleanAuthor(elmt.textContent, "contributor", false)); } } xpath = '//div[@id="recipe_intro"]/p'; if (elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){ var abstract = elmt.textContent; abstract = Zotero.Utilities.cleanString(abstract); newItem.abstractNote = abstract; } xpath = '//div[@id="ingredients"]'; if (elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){ var ingredients = elmt.textContent; ingredients = Zotero.Utilities.superCleanString(ingredients); ingredients = cleanText(ingredients); } xpath = '//div[@id="preparation"]'; if (elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){ var prep = elmt.textContent; prep = Zotero.Utilities.superCleanString(prep); prep = cleanText(prep); prep = prep.replace(/\n/g, "\n\n"); } xpath = '//div[@id="recipe_summary"]/p'; if (elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){ var serving = elmt.textContent; serving = Zotero.Utilities.superCleanString(serving); serving = cleanText(serving); }// notestring = ingredients + "\n\n" + prep + "\n\n" + serving;// newItem.notes.push({note:notestring}); newItem.notes.push({note:ingredients}); newItem.notes.push({note:prep}); newItem.notes.push({note:serving}); var url = doc.location.href; var snapshotURL = url.replace("/views/", "/printerfriendly/"); newItem.attachments.push({title:"Epicurious.com Snapshot", mimeType:"text/html", url:snapshotURL, snapshot:true}); newItem.url = url; newItem.attachments.push({title:"Epicurious.com Link", snapshot:false, mimeType:"text/html", url:url}); newItem.complete();} |
newItem.abstractNote = Zotero.Utilities.cleanString(Zotero.Utilities.cleanTags(metaTags["description"])); | newItem.abstractNote = Zotero.Utilities.trimInternal(Zotero.Utilities.cleanTags(metaTags["description"])); | function scrape(doc, url) { var newItem = new Zotero.Item("blogPost"); newItem.url = doc.location.href; newItem.title = doc.title.substr(0, doc.title.indexOf(" - ")); var titleRE = new RegExp('^http://time-blog.com/([^/]*)/'); var title = titleRE.exec(doc.location.href)[1].split("_"); for (var i = 0 ; i < title.length ; i++) { title[i] = title[i][0].toUpperCase() + title[i].substr(1).toLowerCase(); } newItem.blogTitle = title.join(" "); var metaTags = new Object(); var metaTagHTML = doc.getElementsByTagName("meta"); for (var i = 0 ; i < metaTagHTML.length ; i++) { metaTags[metaTagHTML[i].getAttribute("name")] = metaTagHTML[i].getAttribute("content"); } if (metaTags["description"]) { newItem.abstractNote = Zotero.Utilities.cleanString(Zotero.Utilities.cleanTags(metaTags["description"])); } if (metaTags["date"]) { var date = metaTags["date"]; var months = new Object(); months["jan"] = "January"; months["feb"] = "February"; months["mar"] = "March"; months["apr"] = "April"; months["may"] = "May"; months["jun"] = "June"; months["jul"] = "July"; months["aug"] = "August"; months["sep"] = "September"; months["oct"] = "October"; months["nov"] = "November"; months["dec"] = "December"; date = date.split(".").join("").split(", "); date[0] = months[date[0].split(" ")[0].toLowerCase()] + " " + date[0].split(" ")[1]; newItem.date = date.join(", "); } if (metaTags["keywords"]) { newItem.tags = metaTags["keywords"].split(", "); for (var i in newItem.tags) { if (newItem.tags[i] == "" || newItem.tags[i] == " ") { break; } else { var words = newItem.tags[i].split(" "); for (var j = 0 ; j < words.length ; j++) { if (words[j][0] == words[j][0].toLowerCase() && words[j][0]) { words[j] = words[j][0].toUpperCase() + words[j].substr(1).toLowerCase(); } } } newItem.tags[i] = words.join(" "); } } if (doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { var byline = Zotero.Utilities.cleanString(doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); if (byline.substr(0,9).toLowerCase() == "posted by") { byline = byline.substr(10).split(" "); } else { byline.split(" "); } for (var i = 0; i < byline.length ; i++) { byline[i] = byline[i][0].toUpperCase() + byline[i].substr(1).toLowerCase(); } newItem.creators.push(Zotero.Utilities.cleanAuthor(byline.join(" "), "author")); } else if (newItem.blogTitle == "Theag") { newItem.creators.push(Zotero.Utilities.cleanAuthor("Matthew Yeomans", "author")); newItem.blogTitle = "the Aggregator"; } Zotero.debug(newItem); newItem.complete(); } |