rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
var post = (function(){ var ID = 0; return function(ps){ var id = "post_"+(++ID); var ret = Callbacks[id] = new Deferred(); connection.postMessage({ "type" : "post", "ps" : ps, "id" : id }); return ret; } })();
maybeDeferred(d).addCallback(function(ps){ func(update({ page : title, pageUrl : content.url }, ps)); });
var post = (function(){ var ID = 0; return function(ps){ var id = "post_"+(++ID); var ret = Callbacks[id] = new Deferred(); connection.postMessage({ "type" : "post", "ps" : ps, "id" : id }); return ret; }})();
this.each(function(value, index) { results.push(iterator.call(context, value, index)); });
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
this.each(function(value, index) { results.push(iterator.call(context, value, index)); });
function () { editor.expandAbbreviation(modes.INSERT); },
function () { if (!editor.isTextEdit) modes.push(modes.TEXT_EDIT); else dactyl.beep(); });
function () { editor.expandAbbreviation(modes.INSERT); },
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
frames = frames.filter(function (frame) { frame.focus(); return document.commandDispatcher.focusedWindow == frame; });
util.timeout(function () { doc.body.removeChild(indicator); }, 500);
dactyl.registerObserver("shutdown", function () { if (this._loadPreference("dom.popup_allowed_events", "") == popupAllowedEvents + " keypress") this._storePreference("dom.popup_allowed_events", popupAllowedEvents); });
this.__defineGetter__(name, function () this._optionMap[name].values);
dactyl.registerObserver("shutdown", function () { if (this._loadPreference("dom.popup_allowed_events", "") == popupAllowedEvents + " keypress") this._storePreference("dom.popup_allowed_events", popupAllowedEvents); });
if(attributes["color"]){style+='color:'+attributes["color"]+';';}
if(attributes["color"]&&attributes["color"].match(/^#[0-9a-fA-F]{6}$/)){style+='color:'+attributes["color"]+';';}
return result;};rep(/</gi,"&lt;");rep(/>/gi,"&gt;");rep(/\n/gi,"<br />");rep(/&lt;(\/|)op:(b|u|s|i|font|large|small|color)(?:\s+(.*?)|)&gt;/gi,function(str,isEndTag,org_tagname,attributes_str){var opt="";var style="";var tagname=org_tagname;var attributes=getAttributes(attributes_str);var fontSizeMap=["xx-small","x-small","small","medium","large","x-large","xx-large"];var fontsize=fontSizeMap[3];if(tagname=="font"||tagname=="color"||tagname=="large"||tagname=="small"){tagname="span";}if(isEndTag){return"</"+tagname+">";}if(org_tagname=="font"){if(attributes["size"]){if(fontSizeMap[attributes["size"]-1]){fontsize=fontSizeMap[attributes["size"]-1];}style+='font-size:'+fontsize+';';}if(attributes["color"]){style+='color:'+attributes["color"]+';';}opt=' style="'+style+'"';}if(org_tagname=="color"&&attributes["code"]){opt=' style="color:'+attributes["code"]+';"';}if(org_tagname=="large"){opt=' style="font-size:large"';}if(org_tagname=="small"){opt=' style="font-size:xx-small"';}return"<"+tagname+opt+">";});return s;}});tinymce.PluginManager.add('openpne',tinymce.plugins.OpenPNEPlugin);})();
if(org_tagname=="color"&&attributes["code"]){opt=' style="color:'+attributes["code"]+';"';}
if(org_tagname=="color"&&attributes["code"]&&attributes["code"].match(/^#[0-9a-fA-F]{6}$/)){opt=' style="color:'+attributes["code"]+';"';}
return result;};rep(/</gi,"&lt;");rep(/>/gi,"&gt;");rep(/\n/gi,"<br />");rep(/&lt;(\/|)op:(b|u|s|i|font|large|small|color)(?:\s+(.*?)|)&gt;/gi,function(str,isEndTag,org_tagname,attributes_str){var opt="";var style="";var tagname=org_tagname;var attributes=getAttributes(attributes_str);var fontSizeMap=["xx-small","x-small","small","medium","large","x-large","xx-large"];var fontsize=fontSizeMap[3];if(tagname=="font"||tagname=="color"||tagname=="large"||tagname=="small"){tagname="span";}if(isEndTag){return"</"+tagname+">";}if(org_tagname=="font"){if(attributes["size"]){if(fontSizeMap[attributes["size"]-1]){fontsize=fontSizeMap[attributes["size"]-1];}style+='font-size:'+fontsize+';';}if(attributes["color"]){style+='color:'+attributes["color"]+';';}opt=' style="'+style+'"';}if(org_tagname=="color"&&attributes["code"]){opt=' style="color:'+attributes["code"]+';"';}if(org_tagname=="large"){opt=' style="font-size:large"';}if(org_tagname=="small"){opt=' style="font-size:xx-small"';}return"<"+tagname+opt+">";});return s;}});tinymce.PluginManager.add('openpne',tinymce.plugins.OpenPNEPlugin);})();
function (arg) /^[0-4]$/.test(arg),
CommandOption.defaultValue("type", function () CommandOption.NOARG);
function (arg) /^[0-4]$/.test(arg),
if(separatorPostion > 0 && separatorPostion<len && idx >= len-separatorPostion) { idx++ ; }
objects.forEach(function(object) { if (object) { //Get the name value. If value key is not specified convert obj //to string name = nameKey ? (object.get ? object.get(nameKey) : object[nameKey]) : object.toString() ; // localize name if specified. name = shouldLocalize? name.loc() : name ; //Get the icon value icon = iconKey ? (object.get ? object.get(iconKey) : object[iconKey]) : null ; if (SC.none(object[iconKey])) icon = null ; // get the value using the valueKey or the object value = (valueKey) ? (object.get ? object.get(valueKey) : object[valueKey]) : object ; if (!SC.none(currentSelectedVal) && !SC.none(value)){ if( currentSelectedVal === value ) { this.set('title', name) ; this.set('icon', icon) ; } } //Check if the item is currentSelectedItem or not if(value === this.get('value')) { //set the itemIdx - To change the prefMatrix accordingly. this.set('itemIdx', idx) ; isChecked = !checkboxEnabled ? NO : YES ; } else { isChecked = NO ; } //Check if item is enabled itemEnabled = (isEnabledKey) ? (object.get ? object.get(isEnabledKey) : object[isEnabledKey]) : object ; if(NO !== itemEnabled) itemEnabled = YES ; //Set the first item from the list as default selected item if (idx === 0) { this._defaultVal = value ; this._defaultTitle = name ; this._defaultIcon = icon ; } var item = SC.Object.create({ title: name, icon: icon, value: value, isEnabled: itemEnabled, checkbox: isChecked, target: this, action: 'displaySelectedItem' }) ; //Set the items in the itemList array itemList.push(item); } idx += 1 ; // display the separator if specified by the user if (separatorPostion && idx === (len-separatorPostion)) { var separator = SC.Object.create({ separator: YES }) ; itemList.push(separator); } this.set('itemList', itemList) ; }, this ) ;
array_each(elements, function(a) {
var topics = arrayMap(anchors, function(anchor, index) { var item = anchor, elements = []; while(item && item != anchors[index + 1]) { if(item.tagName && item.tagName.toLowerCase() == "hr") { break; } elements.push(item); item = item.nextSibling; } var tag = document.createElement("div"); insertBefore(anchor, tag); arrayEach(elements, function(a) { var i = xpath(". while(i) { if(i.tagName && i.tagName.toLowerCase() == "hr") { break; } var sibling = i.previousSibling; insertNext(tag, i); i = sibling; }
array_each(elements, function(a) { a.parentNode.removeChild(a); tag.appendChild(a); });
return tag; });
array_each(elements, function(a) { a.parentNode.removeChild(a); tag.appendChild(a); });
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var volume = params.data.volume; c_pagenate.changeTotal(volume.owner_total); c_list.setData(volume.results); c_list.multiCheckList(c_list.detail_template); $("#list_load_mask").unmask(); });
$.each(delete_volumes,function(){ ids.push($(this).text()) })
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var volume = params.data.volume; c_pagenate.changeTotal(volume.owner_total); c_list.setData(volume.results); c_list.multiCheckList(c_list.detail_template); $("#list_load_mask").unmask(); });
}).bind('keyup',function (e) {
}).bind('keypress',function (e) {
return this.each(function() { $this = $(this); // build element specific options var options = $.meta ? $.extend({}, opts, $this.data()) : opts; $this.bind('keydown',function (e) { var kc = $.fn.tabby.catch_kc(e); if (16 == kc) pressed.shft = true; /* because both CTRL+TAB and ALT+TAB default to an event (changing tab/window) that will prevent js from capturing the keyup event, we'll set a timer on releasing them. */ if (17 == kc) {pressed.ctrl = true; setTimeout("$.fn.tabby.pressed.ctrl = false;",1000);} if (18 == kc) {pressed.alt = true; setTimeout("$.fn.tabby.pressed.alt = false;",1000);} if (9 == kc && !pressed.ctrl && !pressed.alt) { e.preventDefault; // does not work in O9.63 ?? pressed.last = kc; setTimeout("$.fn.tabby.pressed.last = null;",0); process_keypress ($(e.target).get(0), pressed.shft, options); return false; } }).bind('keyup',function (e) { if (16 == $.fn.tabby.catch_kc(e)) pressed.shft = false; }).bind('blur',function (e) { // workaround for Opera -- http://www.webdeveloper.com/forum/showthread.php?p=806588 if (9 == pressed.last) $(e.target).one('focus',function (e) {pressed.last = null;}).get(0).focus(); }); });
equals(view.$('.sc-inner').css("width"), "25%", 'width should be 25%');
equals(view.$('.sc-inner')[0].style.width, "25%", 'width should be 25%');
test("basic", function() { var view = pane.view('progress basic'); ok(!view.$().hasClass('disabled'), 'should NOT have disabled class'); ok(view.$('.sc-inner'), 'should have sc-inner class'); ok(view.$('.sc-outer-head'), 'should have sc-outer-head class'); ok(view.$('.sc-outer-tail'), 'should have sc-outer-tail class'); ok(view.$('.sc-inner-head'), 'should have sc-inner-head class'); ok(view.$('.sc-inner-tail'), 'should have sc-inner-tail class'); equals(view.$('.sc-inner').css("width"), "25%", 'width should be 25%'); // browsers compute the width after % adjustment differently. just be close var v = (SC.browser.msie || SC.browser.mozilla) ? 63 : 62; equals(view.$('.sc-inner').width(), v, 'pixel width '); });
equals(child.get("theme"), SC.Theme.find("sc-base"), "view's child's theme should start at base theme");
equals(child.get("theme"), SC.Theme.find('sc-base'), "view's child's theme should start at base theme");
test("adding child to parent propagates theme to child view.", function() { var child = SC.View.create({}); var view = SC.View.create({ theme: "sc-test-1" }); ok(t1 === view.get("theme"), "view's theme should be sc-test-1"); equals(child.get("theme"), SC.Theme.find("sc-base"), "view's child's theme should start at base theme"); view.appendChild(child); equals(t1, child.get("theme"), "view's child's theme should be sc-test-1");});
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/security_groups/list/',c_list.page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ $($('#detail').find('#'+check_id)).remove(); c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/security_groups/show/',check_id) },true);
bt_edit_security_group.target.bind('click',function(event){ var id = $(this).attr('id').replace(/edit_([a-z_]+)/,'$1') if( id ){ bt_edit_security_group.open({"ids":[id]}); } c_list.checkRadioButton(id); $('#detail').html(''); return false;
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ //Update list element c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/security_groups/list/',c_list.page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ //All remove detail element $($('#detail').find('#'+check_id)).remove(); //All reload detail element c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/security_groups/show/',check_id) },true); }); });
});
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ //Update list element c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/security_groups/list/',c_list.page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ //All remove detail element $($('#detail').find('#'+check_id)).remove(); //All reload detail element c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/security_groups/show/',check_id) },true); }); });
}[config.hostApplication] || function () {};
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
}[config.hostApplication] || function () {};
SC.RunLoop.end();
test("should accept shorthand notation", function(){ view.animate('left', 100, 1); equals(transitionFor(view), 'left 1s linear', 'add transition'); });
: function() { return method.apply(context, args.concat(SLICE.call(arguments, 0))); }
return setTimeout(function() { try { f.apply(this, args); } catch(e) { } }, t)
: function() { return method.apply(context, args.concat(SLICE.call(arguments, 0))); }
function (o) {
function (o, extended) {
function (o) { o = '"' + o.replace(/([\"\\])/g, '\\$1') + '"'; o = o.replace(/[\f]/g, "\\f") .replace(/[\b]/g, "\\b") .replace(/[\n]/g, "\\n") .replace(/[\t]/g, "\\t") .replace(/[\r]/g, "\\r"); return o; }],
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var instance = params.data.instance; c_pagenate.changeTotal(instance.owner_total); c_list.setData(instance.results); c_list.multiCheckList(c_list.detail_template); $("#list_load_mask").unmask();
bt_instance_start.target.bind('click',function(){ bt_instance_start.open(c_list.getCheckedInstanceIds());
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var instance = params.data.instance; c_pagenate.changeTotal(instance.owner_total); c_list.setData(instance.results); c_list.multiCheckList(c_list.detail_template); $("#list_load_mask").unmask(); });
this.timeout(function () { dactyl.focusContent(true); }, 10);
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
this.timeout(function () { dactyl.focusContent(true); }, 10); // just make sure, that no widget has focus
}
};
return function(){ method = (typeof method == 'string' ? context[method] : method); return method.apply(context, args.concat(Array.prototype.slice.call(arguments, 0))); }
this.observers[type] = this.observers[type].filter(function (callback) { if (callback.get()) { callback.get().apply(null, args); return true; } });
beep: requiresMainThread(function () { if (options["visualbell"]) { let popup = document.getElementById("dactyl-visualbell"); let win = config.visualbellWindow; let rect = win.getBoundingClientRect(); let width = rect.right - rect.left; let height = rect.bottom - rect.top; popup.openPopup(win, "overlap", 1, 1, false, false); popup.sizeTo(width - 2, height - 2); util.timeout(function () { popup.hidePopup(); }, 20); } else { let soundService = Cc["@mozilla.org/sound;1"].getService(Ci.nsISound); soundService.beep(); } }),
this.observers[type] = this.observers[type].filter(function (callback) { if (callback.get()) { callback.get().apply(null, args); return true; } });
isEnabled: YES,
isEnabled: itemEnabled,
items.forEach(function(object) { if (object) { //Get the name value. If value key is not specified convert obj //to string name = nameKey ? (object.get ? object.get(nameKey) : object[nameKey]) : object.toString() ; // localize name if specified. name = shouldLocalize? name.loc() : name ; //Get the icon value icon = iconKey ? (object.get ? object.get(iconKey) : object[iconKey]) : null ; if (SC.none(object[iconKey])) icon = null ; // get the value using the valueKey or the object value = (valueKey) ? (object.get ? object.get(valueKey) : object[valueKey]) : object ; if (!SC.none(currentSelectedVal) && !SC.none(value)){ if( currentSelectedVal === value ) { this.set('title', name) ; this.set('icon', icon) ; } } //Check if the item is currentSelectedItem or not if(value === this.get('value')) { //set the _itemIdx - To change the prefMatrix accordingly. this.set('_itemIdx', idx) ; isChecked = !showCheckbox ? NO : YES ; } else { isChecked = NO ; } // get the separator isSeparator = separatorKey ? (object.get ? object.get(separatorKey) : object[separatorKey]) : NO; //Set the first item from the list as default selected item if (idx === 0) { this._defaultVal = value ; this._defaultTitle = name ; this._defaultIcon = icon ; } var item = SC.Object.create({ separator: isSeparator, title: name, icon: icon, value: value, isEnabled: YES, checkbox: isChecked, action: this.displaySelectedItem }) ; //Set the items in the itemList array itemList.push(item); } idx += 1 ; this.set('_itemList', itemList) ; }, this ) ;
target: this,
items.forEach(function(object) { if (object) { //Get the name value. If value key is not specified convert obj //to string name = nameKey ? (object.get ? object.get(nameKey) : object[nameKey]) : object.toString() ; // localize name if specified. name = shouldLocalize? name.loc() : name ; //Get the icon value icon = iconKey ? (object.get ? object.get(iconKey) : object[iconKey]) : null ; if (SC.none(object[iconKey])) icon = null ; // get the value using the valueKey or the object value = (valueKey) ? (object.get ? object.get(valueKey) : object[valueKey]) : object ; if (!SC.none(currentSelectedVal) && !SC.none(value)){ if( currentSelectedVal === value ) { this.set('title', name) ; this.set('icon', icon) ; } } //Check if the item is currentSelectedItem or not if(value === this.get('value')) { //set the _itemIdx - To change the prefMatrix accordingly. this.set('_itemIdx', idx) ; isChecked = !showCheckbox ? NO : YES ; } else { isChecked = NO ; } // get the separator isSeparator = separatorKey ? (object.get ? object.get(separatorKey) : object[separatorKey]) : NO; //Set the first item from the list as default selected item if (idx === 0) { this._defaultVal = value ; this._defaultTitle = name ; this._defaultIcon = icon ; } var item = SC.Object.create({ separator: isSeparator, title: name, icon: icon, value: value, isEnabled: YES, checkbox: isChecked, action: this.displaySelectedItem }) ; //Set the items in the itemList array itemList.push(item); } idx += 1 ; this.set('_itemList', itemList) ; }, this ) ;
$.each(thisRef.Data.or, function() { $('#tablePlus_'+this).parent().trigger('click'); });
this.Data.ajax_getData('subsReq', _Settings.dataURL, _Settings.dataURL_params(this.Data), getData, function(){});
$.each(thisRef.Data.or, function() { $('#tablePlus_'+this).parent().trigger('click'); });
$('#detail').html(''); return false;
bt_edit_security_group.target.bind('click',function(event){ var uuid = $(this).attr('id').replace(/edit_(ng-[a-z0-9]+)/,'$1'); if( uuid ){ bt_edit_security_group.open({"ids":[uuid]}); } c_list.checkRadioButton(uuid); $('#detail').html(''); return false; });
Mode.defaultValue("tags", function () function () options.hinttags);
Mode.defaultValue("tags", function () function () options["hinttags"]);
Mode.defaultValue("tags", function () function () options.hinttags);
var $this = $(this).css({ display: 'block', overflow: 'hidden' }), minHeight = $this.height(), interval, heightDiff = this.offsetHeight - minHeight, rowSize = ( parseInt($this.css('lineHeight'), 10) || parseInt($this.css('fontSize'), 10) ), $div = $('<div style="position:absolute;top:-999px;left:-999px;border-color:#000;border-style:solid;overflow-x:hidden;visibility:hidden;z-index:0;" />').appendTo('body'); $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $div.css(prop, $this.css(prop)); }); $this .bind('keypress', function(event) { if ( event.keyCode == '13' ) check(); }) .bind('focus blur', function(event) { if ( event.type == 'blur' ) clearInterval( interval ); if ( event.type == 'focus' ) interval = setInterval(check, options.interval); });
var $this = $(this).css({ display: 'block', overflow: 'hidden' }), minHeight = $this.height(), heightDiff = this.offsetHeight - minHeight, rowSize = ( parseInt($this.css('lineHeight'), 10) || parseInt($this.css('fontSize'), 10) ), $mirror = $('<div style="position:absolute;top:-999px;left:-999px;border-color:#000;border-style:solid;overflow-x:hidden;visibility:hidden;z-index:0;white-space: pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;" />').appendTo('body'), interval; $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $mirror.css(prop, $this.css(prop)); }); $this .bind('keypress', function(event) { if ( event.keyCode == '13' ) check(); }) .bind('focus blur', function(event) { if ( event.type == 'blur' ) clearInterval( interval ); if ( event.type == 'focus' ) interval = setInterval(check, options.interval); });
return this.filter('textarea').each(function() { var $this = $(this).css({ display: 'block', overflow: 'hidden' }), minHeight = $this.height(), interval, heightDiff = this.offsetHeight - minHeight, rowSize = ( parseInt($this.css('lineHeight'), 10) || parseInt($this.css('fontSize'), 10) ), $div = $('<div style="position:absolute;top:-999px;left:-999px;border-color:#000;border-style:solid;overflow-x:hidden;visibility:hidden;z-index:0;" />').appendTo('body'); $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $div.css(prop, $this.css(prop)); }); $this .bind('keypress', function(event) { if ( event.keyCode == '13' ) check(); }) .bind('focus blur', function(event) { if ( event.type == 'blur' ) clearInterval( interval ); if ( event.type == 'focus' ) interval = setInterval(check, options.interval); }); function check() { var text = $this.val(), newHeight, height, usedHeight, usedRows, availableRows; $div.html( text.replace(/\n/g, '&nbsp;<br>').replace(/<(\/?)scrip/g,'<$1scirp') ); height = $this[0].offsetHeight - heightDiff; usedHeight = $div[0].offsetHeight - heightDiff; usedRows = Math.floor(usedHeight / rowSize); availableRows = Math.floor((height / rowSize) - usedRows); if ( availableRows <= options.within ) { newHeight = rowSize * (usedRows + Math.max(availableRows, 0) + options.by); $this.stop().animate({ height: newHeight }, options.duration); } else if ( availableRows > options.by + options.within ) { newHeight = Math.max( height - (rowSize * (availableRows - (options.by + options.within))), minHeight ); $this.stop().animate({ height: newHeight }, options.duration); } }; if ( options.init ) check(); }).end();
function check() { var text = $this.val(), newHeight, height, usedHeight, usedRows, availableRows; $div.html( text.replace(/\n/g, '&nbsp;<br>').replace(/<(\/?)scrip/g,'<$1scirp') ); height = $this[0].offsetHeight - heightDiff; usedHeight = $div[0].offsetHeight - heightDiff; usedRows = Math.floor(usedHeight / rowSize); availableRows = Math.floor((height / rowSize) - usedRows); if ( availableRows <= options.within ) { newHeight = rowSize * (usedRows + Math.max(availableRows, 0) + options.by); $this.stop().animate({ height: newHeight }, options.duration); } else if ( availableRows > options.by + options.within ) { newHeight = Math.max( height - (rowSize * (availableRows - (options.by + options.within))), minHeight ); $this.stop().animate({ height: newHeight }, options.duration); } }; if ( options.init ) check(); }).end();
function check() { var text = $this.val(), newHeight, height, usedHeight, usedRows, availableRows; $mirror.html( encodeHTML(text).replace(/\n/g, '&nbsp;<br>') ); height = $this[0].offsetHeight - heightDiff; usedHeight = $mirror[0].offsetHeight - heightDiff; usedRows = Math.floor(usedHeight / rowSize); availableRows = Math.floor((height / rowSize) - usedRows); if ( availableRows <= options.within ) { newHeight = rowSize * (usedRows + Math.max(availableRows, 0) + options.by); $this.stop().animate({ height: newHeight }, options.duration); } else if ( availableRows > options.by + options.within ) { newHeight = Math.max( height - (rowSize * (availableRows - (options.by + options.within))), minHeight ); $this.stop().animate({ height: newHeight }, options.duration); } }; if ( options.init ) check(); }).end();
return this.filter('textarea').each(function() { var $this = $(this).css({ display: 'block', overflow: 'hidden' }), minHeight = $this.height(), interval, heightDiff = this.offsetHeight - minHeight, rowSize = ( parseInt($this.css('lineHeight'), 10) || parseInt($this.css('fontSize'), 10) ), $div = $('<div style="position:absolute;top:-999px;left:-999px;border-color:#000;border-style:solid;overflow-x:hidden;visibility:hidden;z-index:0;" />').appendTo('body'); $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $div.css(prop, $this.css(prop)); }); $this .bind('keypress', function(event) { if ( event.keyCode == '13' ) check(); }) .bind('focus blur', function(event) { if ( event.type == 'blur' ) clearInterval( interval ); if ( event.type == 'focus' ) interval = setInterval(check, options.interval); }); function check() { var text = $this.val(), newHeight, height, usedHeight, usedRows, availableRows; $div.html( text.replace(/\n/g, '&nbsp;<br>').replace(/<(\/?)scrip/g,'<$1scirp') ); height = $this[0].offsetHeight - heightDiff; usedHeight = $div[0].offsetHeight - heightDiff; usedRows = Math.floor(usedHeight / rowSize); availableRows = Math.floor((height / rowSize) - usedRows); if ( availableRows <= options.within ) { newHeight = rowSize * (usedRows + Math.max(availableRows, 0) + options.by); $this.stop().animate({ height: newHeight }, options.duration); } else if ( availableRows > options.by + options.within ) { newHeight = Math.max( height - (rowSize * (availableRows - (options.by + options.within))), minHeight ); $this.stop().animate({ height: newHeight }, options.duration); } }; if ( options.init ) check(); }).end();
$('#navbar-search-form').click(function() {
$('#navbar-search-form-text').click(function() {
$('#navbar-search-form').click(function() { if ($(this).attr('value') == 'Search') { $(this).attr({'value': ''}); } });
throw new EmptyBufferError("delimiter " + delmiter + "not present in buffer");
throw new EmptyBufferError("delimiter " + delimiter + "not present in buffer");
exports.Buffer = Class(function(supr) { this.init = function(rawBuffer) { this._rawBuffer = !!rawBuffer ? rawBuffer : ""; } this.getLength = function() { return this._rawBuffer.length; } this.append = function(data) { logger.debug('append', JSON.stringify(data)); this._rawBuffer += data; } this.peekBytes = function(num) { if (!!num) return this._rawBuffer.slice(0, num); else return this._rawBuffer; } this.peekToDelimiter = function(delimiter) { delimiter = delimiter ? delimiter : '\n'; var i = this._rawBuffer.indexOf(delimiter); if (i == -1) throw new EmptyBufferError("delimiter " + delmiter + "not present in buffer"); else return this._rawBuffer.slice(0, i); } this.consumeBytes = function(num) { var output = this.peekBytes(num); this._rawBuffer = this._rawBuffer.slice(output.length); return output; } this.consumeMaxBytes = function(num) { var output = this._rawBuffer.slice(0, num); this._rawBuffer = this._rawBuffer(num); return output; } this.consumeAllBytes = function() { var temp = this._rawBuffer; this._rawBuffer = ""; return temp; } this.consumeThroughDelimiter = function(delimiter) { return this.consumeToDelimiter(delimiter) + this.consumeBytes(delimiter.length); } this.consumeToDelimiter = function(delimiter) { delimiter = !!delimiter ? delimiter : "\n" var output = this.peekToDelimiter(delimiter); this._rawBuffer = this._rawBuffer.slice(output.length); return output; } this.hasBytes = function(num) { num = num ? num : 0; return this._rawBuffer.length >= num; } this.hasDelimiter = function(delimiter) { delimiter = !!delimiter ? delimiter : '\n'; return (this._rawBuffer.indexOf(delimiter) != -1); }})
this.editFileExternally(tmpfile.path);
let lastUpdate = Date.now(); function update (force) { if (force != true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now();
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); elem = textBox; } else if (nsEditor) { nsEditor.flags |= Ci.nsIPlaintextEditor.eEditorReadonlyMask; elem = nsEditor.rootElement; } oldBg = elem.style.backgroundColor; tmpBg = "yellow"; elem.style.backgroundColor = "#bbbbbb"; if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); let val = tmpfile.read(); if (textBox) { textBox.removeAttribute("readonly"); textBox.value = val; } else if (nsEditor) { nsEditor.flags &= ~Ci.nsIPlaintextEditor.eEditorReadonlyMask; let wholeDocRange = nsEditor.document.createRange(); let rootNode = nsEditor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); nsEditor.selection.addRange(wholeDocRange); nsEditor.selection.deleteFromDocument(); if (isHTML) { let doc = nsEditor.document; let htmlFragment = doc.implementation.createDocument(null, 'html', null); let range = doc.createRange(); range.setStartAfter(doc.body); doc.body.appendChild(range.createContextualFragment(val)); } else { nsEditor.insertText(val); } } }, this);
let val = tmpfile.read(); if (textBox) { textBox.removeAttribute("readonly"); textBox.value = val; } else if (nsEditor) { nsEditor.flags &= ~Ci.nsIPlaintextEditor.eEditorReadonlyMask; let wholeDocRange = nsEditor.document.createRange(); let rootNode = nsEditor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); nsEditor.selection.addRange(wholeDocRange); nsEditor.selection.deleteFromDocument(); if (isHTML) { let doc = nsEditor.document; let htmlFragment = doc.implementation.createDocument(null, 'html', null); let range = doc.createRange(); range.setStartAfter(doc.body); doc.body.appendChild(range.createContextualFragment(val)); } else { nsEditor.insertText(val);
let val = tmpfile.read(); if (textBox) textBox.value = val; else if (nsEditor) { let wholeDocRange = nsEditor.document.createRange(); let rootNode = nsEditor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); nsEditor.selection.addRange(wholeDocRange); nsEditor.selection.deleteFromDocument(); if (isHTML) { let doc = nsEditor.document; let htmlFragment = doc.implementation.createDocument(null, 'html', null); let range = doc.createRange(); range.setStartAfter(doc.body); doc.body.appendChild(range.createContextualFragment(val)); } else { nsEditor.insertText(val); }
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); elem = textBox; } else if (nsEditor) { nsEditor.flags |= Ci.nsIPlaintextEditor.eEditorReadonlyMask; elem = nsEditor.rootElement; } oldBg = elem.style.backgroundColor; tmpBg = "yellow"; elem.style.backgroundColor = "#bbbbbb"; if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); let val = tmpfile.read(); if (textBox) { textBox.removeAttribute("readonly"); textBox.value = val; } else if (nsEditor) { nsEditor.flags &= ~Ci.nsIPlaintextEditor.eEditorReadonlyMask; let wholeDocRange = nsEditor.document.createRange(); let rootNode = nsEditor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); nsEditor.selection.addRange(wholeDocRange); nsEditor.selection.deleteFromDocument(); if (isHTML) { let doc = nsEditor.document; let htmlFragment = doc.implementation.createDocument(null, 'html', null); let range = doc.createRange(); range.setStartAfter(doc.body); doc.body.appendChild(range.createContextualFragment(val)); } else { nsEditor.insertText(val); } } }, this);
let timer = services.create("timer"); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path); } finally { timer.cancel(); } update(true);
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); elem = textBox; } else if (nsEditor) { nsEditor.flags |= Ci.nsIPlaintextEditor.eEditorReadonlyMask; elem = nsEditor.rootElement; } oldBg = elem.style.backgroundColor; tmpBg = "yellow"; elem.style.backgroundColor = "#bbbbbb"; if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); let val = tmpfile.read(); if (textBox) { textBox.removeAttribute("readonly"); textBox.value = val; } else if (nsEditor) { nsEditor.flags &= ~Ci.nsIPlaintextEditor.eEditorReadonlyMask; let wholeDocRange = nsEditor.document.createRange(); let rootNode = nsEditor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); nsEditor.selection.addRange(wholeDocRange); nsEditor.selection.deleteFromDocument(); if (isHTML) { let doc = nsEditor.document; let htmlFragment = doc.implementation.createDocument(null, 'html', null); let range = doc.createRange(); range.setStartAfter(doc.body); doc.body.appendChild(range.createContextualFragment(val)); } else { nsEditor.insertText(val); } } }, this);
top.Event.observe(document.body, 'keypress', function(event) { if (event.which == 0) { closeHTMLpop(); } });
}).invoke('observe', 'mouseover', function(evt) { evt.preventDefault(); } );
top.Event.observe(document.body, 'keypress', function(event) { if (event.which == 0) { closeHTMLpop(); } });
equals(child.get('layoutStyle')[key], no_s[key], "STYLE NO PARENT %@".fmt(key)) ;
testKey = key === 'transform' ? SC.platform.domCSSPrefix+'Transform' : key; equals(child.get('layoutStyle')[testKey], no_s[key], "STYLE NO PARENT %@".fmt(key)) ;
keys.forEach(function(key) { equals(child.get('layoutStyle')[key], no_s[key], "STYLE NO PARENT %@".fmt(key)) ; });
var bindingElement = this.bindingTypeElements.filter(function(el) { return el.bindingType == visTypeResults[i].type.value; } )[0];
var bindingElement = this.bindingTypeElements.filter(function(el) { return el.bindingType == visBindingTypes[i].type.value; } )[0];
var bindingElement = this.bindingTypeElements.filter(function(el) { return el.bindingType == visTypeResults[i].type.value; } )[0];
function() { PS_LOG('Minimal beacon failed to send results.'); });
function(data) { var resultsContainer = data.resultsContainer; PAGESPEED.minimalBeacon.sendBeacon(resultsContainer, true); });
function() { PS_LOG('Minimal beacon failed to send results.'); });
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var image = params.data.image; c_pagenate.changeTotal(image.owner_total); c_list.setData(image.results); c_list.singleCheckList(c_list.detail_template); $("#list_load_mask").unmask();
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ $($('#detail').find('#'+check_id)).remove(); c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/show/',check_id) },true); });
c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ var image = params.data.image; c_pagenate.changeTotal(image.owner_total); c_list.setData(image.results); c_list.singleCheckList(c_list.detail_template); $("#list_load_mask").unmask(); });
test("should have span with title inside", function() { var q = Q$('span', view.get('layer')); ok(view.get('displayTitle').length>0, 'precond - display title should not be empty'); equals(q.text(), view.get('displayTitle'), 'should have display title');
test("double-check that there is NO input element. Just in case.", function(){ equals(view.$("input").length, 0, "CoreQuery lookup for inputs should have length of 0.");
test("should have span with title inside", function() { var q = Q$('span', view.get('layer')); ok(view.get('displayTitle').length>0, 'precond - display title should not be empty'); equals(q.text(), view.get('displayTitle'), 'should have display title');});
this.map(this.ignore_types, function(string) { if (types[string] == undefined) ignore_types.push(string); });
this.map(show_types, function(string) { types[string] = undefined; });
this.map(this.ignore_types, function(string) { if (types[string] == undefined) ignore_types.push(string); });
csp.Session = Class(function() { this.init = function () { this.key = uuid.uuid(8); sessionDict[this.key] = this; this.connection = null; this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { 'contentType' : 'text/html', 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '',
exports.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed)
csp.Session = Class(function() { this.init = function () { // this.lastAck = 0; // 'a' variable this.key = uuid.uuid(8); // generate 8-character base-62 UUID sessionDict[this.key] = this; // Add session to sessions dictionary this.connection = null; // this.connection set from outside. this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { // set variables to defaults 'contentType' : 'text/html', // 'prebufferSize' : '0', // result stored in 'prebuffer' variable. 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '', }; this.resetTimeoutTimer(); }; this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); // XXX when the client calls close, do we want to allow the server to // keep sending them stuff, write only? And what about when they time out? delete sessionDict[this.key]; }; // send data to the client this.send = function (data) { // base64-encode any string data with control characters or non-ASCII var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); }; // else if no comet connection, just keep buffering packets }; this.close = function () { // call this to close a comet connection, and stop writing to it. // any remaining incoming packets will still fire 'receive' events. this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; // if gzipOk or contentType changes value, finish up any comet response // with the previous values if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { // string of spaces of length prebufferSize this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); // Give the client 50% longer than the duration of a comet request before // we time them out. var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; // XXX: Make Access-Control configurable if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; // default value var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { // ID of last packet in the batch is the "SSE ID" suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); // close a stream this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() // send empty batch to poll/longpoll }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); // remove first element }; }; // used for handshake, send, and close (not comet or reflect) this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; // a csp.Server instance dispatches resources to this object's functions this.dispatch = { handshake: function (request, response) { // debug('calling stringify'); var body = JSON.stringify( {'session': this.key}) // debug('stringify called'); this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; // we have buffered packets, so send them. if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; // if we have no events to deliver, or if this is a stream, start a // duration timer, after which the response will always complete if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { // packetId, encoding, content = batch.shift() var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; // XXX probably should end connection here. }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; // this can leave packets in the buffer, to handled later, in order this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); // XXX who knows what this does...? }, };});
this.resetTimeoutTimer();
this.emit('receive', data);
csp.Session = Class(function() { this.init = function () { // this.lastAck = 0; // 'a' variable this.key = uuid.uuid(8); // generate 8-character base-62 UUID sessionDict[this.key] = this; // Add session to sessions dictionary this.connection = null; // this.connection set from outside. this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { // set variables to defaults 'contentType' : 'text/html', // 'prebufferSize' : '0', // result stored in 'prebuffer' variable. 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '', }; this.resetTimeoutTimer(); }; this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); // XXX when the client calls close, do we want to allow the server to // keep sending them stuff, write only? And what about when they time out? delete sessionDict[this.key]; }; // send data to the client this.send = function (data) { // base64-encode any string data with control characters or non-ASCII var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); }; // else if no comet connection, just keep buffering packets }; this.close = function () { // call this to close a comet connection, and stop writing to it. // any remaining incoming packets will still fire 'receive' events. this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; // if gzipOk or contentType changes value, finish up any comet response // with the previous values if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { // string of spaces of length prebufferSize this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); // Give the client 50% longer than the duration of a comet request before // we time them out. var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; // XXX: Make Access-Control configurable if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; // default value var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { // ID of last packet in the batch is the "SSE ID" suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); // close a stream this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() // send empty batch to poll/longpoll }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); // remove first element }; }; // used for handshake, send, and close (not comet or reflect) this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; // a csp.Server instance dispatches resources to this object's functions this.dispatch = { handshake: function (request, response) { // debug('calling stringify'); var body = JSON.stringify( {'session': this.key}) // debug('stringify called'); this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; // we have buffered packets, so send them. if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; // if we have no events to deliver, or if this is a stream, start a // duration timer, after which the response will always complete if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { // packetId, encoding, content = batch.shift() var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; // XXX probably should end connection here. }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; // this can leave packets in the buffer, to handled later, in order this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); // XXX who knows what this does...? }, };});
this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); delete sessionDict[this.key];
var validEncodings = new Hash('utf8', 'binary'); this.setEncoding = function (encoding) { assert(validEncodings.contains(encoding), 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding;
csp.Session = Class(function() { this.init = function () { // this.lastAck = 0; // 'a' variable this.key = uuid.uuid(8); // generate 8-character base-62 UUID sessionDict[this.key] = this; // Add session to sessions dictionary this.connection = null; // this.connection set from outside. this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { // set variables to defaults 'contentType' : 'text/html', // 'prebufferSize' : '0', // result stored in 'prebuffer' variable. 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '', }; this.resetTimeoutTimer(); }; this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); // XXX when the client calls close, do we want to allow the server to // keep sending them stuff, write only? And what about when they time out? delete sessionDict[this.key]; }; // send data to the client this.send = function (data) { // base64-encode any string data with control characters or non-ASCII var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); }; // else if no comet connection, just keep buffering packets }; this.close = function () { // call this to close a comet connection, and stop writing to it. // any remaining incoming packets will still fire 'receive' events. this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; // if gzipOk or contentType changes value, finish up any comet response // with the previous values if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { // string of spaces of length prebufferSize this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); // Give the client 50% longer than the duration of a comet request before // we time them out. var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; // XXX: Make Access-Control configurable if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; // default value var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { // ID of last packet in the batch is the "SSE ID" suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); // close a stream this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() // send empty batch to poll/longpoll }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); // remove first element }; }; // used for handshake, send, and close (not comet or reflect) this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; // a csp.Server instance dispatches resources to this object's functions this.dispatch = { handshake: function (request, response) { // debug('calling stringify'); var body = JSON.stringify( {'session': this.key}) // debug('stringify called'); this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; // we have buffered packets, so send them. if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; // if we have no events to deliver, or if this is a stream, start a // duration timer, after which the response will always complete if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { // packetId, encoding, content = batch.shift() var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; // XXX probably should end connection here. }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; // this can leave packets in the buffer, to handled later, in order this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); // XXX who knows what this does...? }, };});
this.send = function (data) { var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); };
var validReadyStates = new Hash('writeOnly', 'open'); this.send = function (data, encoding) { if (!validReadyStates.contains(this.readyState)) { throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; assert(validEncodings.contains(encoding), 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data);
csp.Session = Class(function() { this.init = function () { // this.lastAck = 0; // 'a' variable this.key = uuid.uuid(8); // generate 8-character base-62 UUID sessionDict[this.key] = this; // Add session to sessions dictionary this.connection = null; // this.connection set from outside. this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { // set variables to defaults 'contentType' : 'text/html', // 'prebufferSize' : '0', // result stored in 'prebuffer' variable. 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '', }; this.resetTimeoutTimer(); }; this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); // XXX when the client calls close, do we want to allow the server to // keep sending them stuff, write only? And what about when they time out? delete sessionDict[this.key]; }; // send data to the client this.send = function (data) { // base64-encode any string data with control characters or non-ASCII var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); }; // else if no comet connection, just keep buffering packets }; this.close = function () { // call this to close a comet connection, and stop writing to it. // any remaining incoming packets will still fire 'receive' events. this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; // if gzipOk or contentType changes value, finish up any comet response // with the previous values if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { // string of spaces of length prebufferSize this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); // Give the client 50% longer than the duration of a comet request before // we time them out. var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; // XXX: Make Access-Control configurable if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; // default value var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { // ID of last packet in the batch is the "SSE ID" suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); // close a stream this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() // send empty batch to poll/longpoll }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); // remove first element }; }; // used for handshake, send, and close (not comet or reflect) this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; // a csp.Server instance dispatches resources to this object's functions this.dispatch = { handshake: function (request, response) { // debug('calling stringify'); var body = JSON.stringify( {'session': this.key}) // debug('stringify called'); this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; // we have buffered packets, so send them. if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; // if we have no events to deliver, or if this is a stream, start a // duration timer, after which the response will always complete if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { // packetId, encoding, content = batch.shift() var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; // XXX probably should end connection here. }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; // this can leave packets in the buffer, to handled later, in order this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); // XXX who knows what this does...? }, };});
this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); }; }; this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; this.dispatch = { handshake: function (request, response) { var body = JSON.stringify( {'session': this.key}) this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); },
this._session.close();
csp.Session = Class(function() { this.init = function () { // this.lastAck = 0; // 'a' variable this.key = uuid.uuid(8); // generate 8-character base-62 UUID sessionDict[this.key] = this; // Add session to sessions dictionary this.connection = null; // this.connection set from outside. this.outgoingPacketBuffer = []; this.incomingPacketBuffer = []; this.lastSequentialIncomingId = 0 this.cometResponse = null; this.durationTimer = null; this.intervalTimer = null; this.timeoutTimer = null; this.outgoingPacketId = 1; this.variables = { // set variables to defaults 'contentType' : 'text/html', // 'prebufferSize' : '0', // result stored in 'prebuffer' variable. 'prebuffer' : '', 'preamble' : '', 'requestPrefix' : '', 'requestSuffix' : '', 'batchPrefix' : '', 'batchSuffix' : '', 'interval' : '0', 'duration' : '30', 'isStreaming' : '0', 'gzipOk' : '', 'sse' : '', }; this.resetTimeoutTimer(); }; this.teardownSession = function () { $clearTimeout(this.durationTimer); this.connection.readyState = (this.connection.readyState === 'open' ? 'writeOnly' : 'closed'); this.connection.emit('eof'); // XXX when the client calls close, do we want to allow the server to // keep sending them stuff, write only? And what about when they time out? delete sessionDict[this.key]; }; // send data to the client this.send = function (data) { // base64-encode any string data with control characters or non-ASCII var packet = (typeof data === 'string' && (/[^\r\n\t\x32-\x7E]/).test(data)) ? [this.outgoingPacketId, 1, base64.encode(data)] : [this.outgoingPacketId, 0, data]; this.outgoingPacketId += 1; this.outgoingPacketBuffer.push(packet); if (this.cometResponse) { this.sendBatch([packet]); }; // else if no comet connection, just keep buffering packets }; this.close = function () { // call this to close a comet connection, and stop writing to it. // any remaining incoming packets will still fire 'receive' events. this.send(null); this.connection.readyState = (this.connection.readyState === 'open' ? 'readOnly' : 'closed'); }; this.updateVars = function (params) { for (param in params) { var key = varNames[param]; if (!key) continue; var value = params[param]; // if gzipOk or contentType changes value, finish up any comet response // with the previous values if (key in Set('gzipOk', 'contentType') && value != this.variables[key] && this.cometResponse) { this.completeResponse(); }; if (key in this.variables) { this.variables[key] = value; } else if (key == 'prebufferSize') { var prebufferSize = parseInt(value); if (prebufferSize > 0) { // string of spaces of length prebufferSize this.variables.prebuffer = (new Array(prebufferSize+1)).join(' '); }; }; }; }; this.isStreaming = function () { return (this.variables.isStreaming === '1') && (parseInt(this.variables.duration) > 0); }; this.resetDurationTimer = function () { var duration = 1000 * parseInt(this.variables.duration); this.durationTimer = $setTimeout(bind(this, this.completeResponse), duration); }; this.resetIntervalTimer = function () { $clearTimeout(this.intervalTimer); if (this.variables.interval === '0') { return; }; var interval = 1000 * parseInt(this.variables.interval); this.intervalTimer = $setTimeout(bind(this, this.sendBatch), interval); }; this.resetTimeoutTimer = function () { $clearTimeout(this.timeoutTimer); // Give the client 50% longer than the duration of a comet request before // we time them out. var timeout = 1000 * parseInt(this.variables.duration) * 1.5; this.timeoutTimer = $setTimeout(bind(this, this.teardownSession), timeout); }; this.sendHeaders = function (response, contentLength) { var allowOrigin = '*'; // XXX: Make Access-Control configurable if (contentLength === 'stream') { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Transfer-Encoding' : 'chunked', 'Access-Control-Allow-Origin' : allowOrigin }); } else if (contentLength >= 0) { response.sendHeader(200, { 'Content-Type' : this.variables.contentType, 'Cache-Control' : 'no-cache, must-revalidate', 'Content-Length' : contentLength, 'Access-Control-Allow-Origin' : allowOrigin }); }; }; this.startStream = function () { this.sendHeaders(this.cometResponse, 'stream'); var preamble = this.variables.prebuffer + this.variables.preamble; if (preamble) { this.cometResponse.sendBody(preamble); }; this.resetIntervalTimer(); }; this.sendBatch = function (packetArray) { if (!packetArray) { packetArray = []; }; // default value var prefix = this.variables.batchPrefix + '('; var suffix = ')' + this.variables.batchSuffix; if (this.variables.sse === '1' && packetArray) { // ID of last packet in the batch is the "SSE ID" suffix += 'id: ' + packetArray[packetArray.length - 1][0] + '\r\n'; }; var batch = prefix + JSON.stringify(packetArray) + suffix; if (this.isStreaming()) { this.cometResponse.sendBody(batch); this.resetIntervalTimer(); } else { var body = (this.variables.prebuffer + this.variables.preamble + batch); this.sendHeaders(this.cometResponse, body.length) this.cometResponse.sendBody(body); this.cometResponse.finish(); this.cometResponse = null; $clearTimeout(this.durationTimer); }; }; this.completeResponse = function() { if (this.isStreaming()) { this.cometResponse.finish(); // close a stream this.cometResponse = null; $clearTimeout(this.durationTimer); $clearTimeout(this.intervalTimer); } else { this.sendBatch() // send empty batch to poll/longpoll }; }; this.receiveAck = function (ackId) { this.resetTimeoutTimer(); while (this.outgoingPacketBuffer.length && ackId >= this.outgoingPacketBuffer[0][0]) { this.outgoingPacketBuffer.shift(); // remove first element }; }; // used for handshake, send, and close (not comet or reflect) this.renderResponse = function (response, body) { var prefix = this.variables.requestPrefix + '('; var suffix = ')' + this.variables.requestSuffix; body = prefix + body + suffix; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }; // a csp.Server instance dispatches resources to this object's functions this.dispatch = { handshake: function (request, response) { // debug('calling stringify'); var body = JSON.stringify( {'session': this.key}) // debug('stringify called'); this.renderResponse(response, body); }, comet: function (request, response) { this.cometResponse = response; if (this.isStreaming()) { this.startStream(); }; // we have buffered packets, so send them. if (this.outgoingPacketBuffer.length) { this.sendBatch(this.outgoingPacketBuffer); }; // if we have no events to deliver, or if this is a stream, start a // duration timer, after which the response will always complete if (!this.outgoingPacketBuffer.length || this.isStreaming()) { this.resetDurationTimer(); }; }, send: function (request, response) { var batch = JSON.parse(request.data); logger.debug('received packet batch:', batch); while (batch[0] != undefined) { // packetId, encoding, content = batch.shift() var packet = batch.shift(), packetId = packet[0], encoding = packet[1], content = packet[2]; if (encoding === 0) { packetContent = content; } else if (encoding === 1) { packetContent = base64.decode(content); } else { debug('BAD PACKET ENCODING,', encoding, '... dropping packet'); break; // XXX probably should end connection here. }; this.incomingPacketBuffer[packetId - 1 - this.lastSequentialIncomingId] = packetContent; }; logger.debug('incomingPacketBuffer', this.incomingPacketBuffer); while (this.incomingPacketBuffer[0] !== undefined) { var nextPacketPayload = this.incomingPacketBuffer.shift(); this.lastSequentialIncomingId += 1; this.connection._receive(nextPacketPayload); }; // this can leave packets in the buffer, to handled later, in order this.renderResponse(response, '"OK"'); }, close: function (request, response) { this.teardownSession(); this.renderResponse(response, '"OK"'); }, reflect: function (request, response) { var body = request.data; this.sendHeaders(response, body.length); response.sendBody(body); response.finish(); }, streamtest: function (request, response) { debug('streamtest'); // XXX who knows what this does...? }, };});
list_request.url = DcmgrGUI.Util.getPagePath('/images/show/',c_pagenate.current_page);
c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow)
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ list_request.url = DcmgrGUI.Util.getPagePath('/images/show/',c_pagenate.current_page); c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) //update detail $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) },true); }); });
url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id)
url:DcmgrGUI.Util.getPagePath('/images/show/',check_id)
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ list_request.url = DcmgrGUI.Util.getPagePath('/images/show/',c_pagenate.current_page); c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) //update detail $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) },true); }); });
layers.push(scriptName);
addLayer(scriptName);
html.replace(/dojo\.require\(["']([^'"]+)["']\)/g, function(t, scriptName){ // for each dojo.require call add it to the layers as well layers.push(scriptName); });
if (!el.hasClassName("broadcast")) el.disabled = false;
if (!el.hasClassName("broadcast")) el.enable();
$$("input.broadcast").each(function(e) { e.observe("change", function(ev) { if (ev.element().checked) { $$("input[chip=\"" + ev.element().readAttribute("chip") + "\"]").each(function(el) { if (!el.hasClassName("broadcast")) el.disabled = true; }); } else { $$("input[chip=\"" + ev.element().readAttribute("chip") + "\"]").each(function(el) { if (!el.hasClassName("broadcast")) el.disabled = false; }); } }); });
setTimeout(function(){ d.callback(tab); }, 0);
chrome.tabs.getSelected(null, function(tab){ if(background.TBRL.Service.isEnableSite(tab.url)){ tab = tab; d.callback(tab); } else { window.close(); } });
setTimeout(function(){ d.callback(tab); }, 0);
context.quote = [args.last, function (text) util.escapeString(text.substr(args.offset), ""), args.last];
context.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text));
context.quote = [args.last, function (text) util.escapeString(text.substr(args.offset), ""), args.last];
this.element.bind('dcmgrGUI.contentChange',function(event,params){ self.setData(params.data); self.checkList(self.detail_template);
this.element.bind('dcmgrGUI.afterUpdate',function(event){ var bg; var kids; $("table").find('td').hover( function () { bg = $(this).parent().css("background-color"); kids = $(this).parent().children(); kids.css("background-color","#82c9d9"); }, function () { kids.css("background-color",bg); } ); self.element.find("[type='checkbox']").each(function(key,value){ var id = $(value).val(); if(self.checked_list[id]){ $(event.target).find("[type='checkbox']").each(function(){ if($(this).val() === id){ $(this).attr('checked',true); } }) } })
this.element.bind('dcmgrGUI.contentChange',function(event,params){ self.setData(params.data); self.checkList(self.detail_template); });
q.sort(function (a, b) { return a - b; });
$.getJSON(this.DATA_DIR + prefix + this.JSON, null, function (data) { data.prefix = prefix; me._dict = data; if (callback) { callback(schema); } });
q.sort(function (a, b) { return a - b; });
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); if (textBox) textBox.removeAttribute("readonly"); let val = tmpfile.read(); if (textBox) textBox.value = val; else { let editor = GetCurrentEditor(); let wholeDocRange = editor.document.createRange(); let rootNode = editor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); editor.selection.addRange(wholeDocRange); editor.selection.deleteFromDocument(); editor.insertText(val); } }, this);
function (resp) { if (resp && resp.match(/^y(es)?$/i)) editor.editFieldExternally(true); });
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); if (textBox) textBox.removeAttribute("readonly"); let val = tmpfile.read(); if (textBox) textBox.value = val; else { let editor = GetCurrentEditor(); let wholeDocRange = editor.document.createRange(); let rootNode = editor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); editor.selection.addRange(wholeDocRange); editor.selection.deleteFromDocument(); editor.insertText(val); } }, this);
test("creates a context and then invokes prepareContext on each childView", function() {
test("creates a context and then invokes renderToContext or updateLayer on each childView", function() {
test("creates a context and then invokes prepareContext on each childView", function() { var runCount = 0, curContext, curFirstTime ; var ChildView = SC.View.extend({ prepareContext: function(context, firstTime) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(firstTime, curFirstTime, 'passed first time flag'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); curFirstTime= YES ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); curFirstTime= NO ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view');});
prepareContext: function(context, firstTime) {
renderToContext: function(context) {
test("creates a context and then invokes prepareContext on each childView", function() { var runCount = 0, curContext, curFirstTime ; var ChildView = SC.View.extend({ prepareContext: function(context, firstTime) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(firstTime, curFirstTime, 'passed first time flag'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); curFirstTime= YES ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); curFirstTime= NO ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view');});
equals(firstTime, curFirstTime, 'passed first time flag');
test("creates a context and then invokes prepareContext on each childView", function() { var runCount = 0, curContext, curFirstTime ; var ChildView = SC.View.extend({ prepareContext: function(context, firstTime) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(firstTime, curFirstTime, 'passed first time flag'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); curFirstTime= YES ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); curFirstTime= NO ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view');});
equals(runCount, 3, 'prepareContext() invoked for each child view');
equals(runCount, 3, 'renderToContext() invoked for each child view');
test("creates a context and then invokes prepareContext on each childView", function() { var runCount = 0, curContext, curFirstTime ; var ChildView = SC.View.extend({ prepareContext: function(context, firstTime) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(firstTime, curFirstTime, 'passed first time flag'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); curFirstTime= YES ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); curFirstTime= NO ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view');});
equals(runCount, 3, 'prepareContext() invoked for each child view');
equals(runCount, 3, 'updateLayer() invoked for each child view');
test("creates a context and then invokes prepareContext on each childView", function() { var runCount = 0, curContext, curFirstTime ; var ChildView = SC.View.extend({ prepareContext: function(context, firstTime) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(firstTime, curFirstTime, 'passed first time flag'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); curFirstTime= YES ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); curFirstTime= NO ; equals(view.renderChildViews(curContext, curFirstTime), curContext, 'returns context'); equals(runCount, 3, 'prepareContext() invoked for each child view');});
$('#dataTable_0 tbody a').parents('td').click(function(){ thisRef.gotoTask_click(this); });
this.Data.ajax_getData_sync('expand', _Settings.expandData.dataURL, _Settings.expandData.dataURL_params(this.Data, rowDataSet), processData, function(){});
$('#dataTable_0 tbody a').parents('td').click(function(){ thisRef.gotoTask_click(this); });
n=DOM.add(tr,'td');n=DOM.add(n,'img',{src:op_get_relative_uri_root()+"/images/emoji/"+s.carrier+"/"+s.carrier+i+".gif",alt:"["+s.carrier+":"+i+"]"});Event.add(n,'mousedown',function(e){if(Prototype.Browser.IE){tinyMCE.execCommand("mceInsertContent",false,e.srcElement.getAttribute("alt"));}else{tinyMCE.execCommand("mceInsertContent",false,e.element().getAttribute("alt"));}});}}
n=DOM.add(tr,'td');n=DOM.add(n,'img',{src:op_get_relative_uri_root()+"/images/emoji/"+s.carrier+"/"+s.carrier+i+".gif",alt:"["+s.carrier+":"+i+"]",width:12,height:12});Event.add(n,'mousedown',function(e){if(Prototype.Browser.IE){tinyMCE.execCommand("mceInsertContent",false,e.srcElement.getAttribute("alt"));}else{tinyMCE.execCommand("mceInsertContent",false,e.element().getAttribute("alt"));}});}}
n=DOM.add(tr,'td');n=DOM.add(n,'img',{src:op_get_relative_uri_root()+"/images/emoji/"+s.carrier+"/"+s.carrier+i+".gif",alt:"["+s.carrier+":"+i+"]"});Event.add(n,'mousedown',function(e){if(Prototype.Browser.IE){tinyMCE.execCommand("mceInsertContent",false,e.srcElement.getAttribute("alt"));}else{tinyMCE.execCommand("mceInsertContent",false,e.element().getAttribute("alt"));}});}}
$.each(AjaxHooks.postAjaxCallbacks, function() { this(updatedDomElements); });
$(document).ready(function() { if (Wicket.Ajax) Wicket.Ajax.registerPostCallHandler(AjaxHooks.firePostAjax); });
$.each(AjaxHooks.postAjaxCallbacks, function() { this(updatedDomElements); });
Y.on( 'domready', function() { updateSubdivisions( Y.Node.get( '#country' ) ); if ( Y.Node.get( '#shipping-checkbox' ) ) { updateSubdivisions( Y.Node.get( '#s_country' ) ); Y.on( 'change', function( e ) { if ( Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#country'); Y.on( 'change', function( e ) { if ( !Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#s_country'); Y.on( 'click', function( e ) { changeShipping(); updateShipping(); }, '#shipping-checkbox'); } if (Y.Node.get( '#AutomaticDeliveryTooltip' ) && Y.Node.get( '#show_auto_tip' ) ) { AutomaticDeliverTooltip( '#show_auto_tip', '#AutomaticDeliveryTooltip' ); } });
Y.on( 'domready', function() { if ( Y.Node.get( '#country' ) ) { updateSubdivisions( Y.Node.get( '#country' ) ); } if ( Y.Node.get( '#shipping-checkbox' ) ) { if ( Y.Node.get( '#s_country' ) ) { updateSubdivisions( Y.Node.get( '#s_country' ) ); } Y.on( 'change', function( e ) { if ( Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#country'); Y.on( 'change', function( e ) { if ( !Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#s_country'); Y.on( 'click', function( e ) { changeShipping(); updateShipping(); }, '#shipping-checkbox'); } if (Y.Node.get( '#AutomaticDeliveryTooltip' ) && Y.Node.get( '#show_auto_tip' ) ) { AutomaticDeliverTooltip( '#show_auto_tip', '#AutomaticDeliveryTooltip' ); } });
Y.on( 'domready', function() { updateSubdivisions( Y.Node.get( '#country' ) ); if ( Y.Node.get( '#shipping-checkbox' ) ) { updateSubdivisions( Y.Node.get( '#s_country' ) ); Y.on( 'change', function( e ) { if ( Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#country'); Y.on( 'change', function( e ) { if ( !Y.Node.get( '#shipping-checkbox' ).get( 'checked' ) ) { updateShipping(); } updateSubdivisions( e.currentTarget ); }, '#s_country'); Y.on( 'click', function( e ) { changeShipping(); updateShipping(); }, '#shipping-checkbox'); } if (Y.Node.get( '#AutomaticDeliveryTooltip' ) && Y.Node.get( '#show_auto_tip' ) ) { AutomaticDeliverTooltip( '#show_auto_tip', '#AutomaticDeliveryTooltip' ); } });
list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page, c_list.maxrow)
list_request.data = DcmgrGUI.Util.getPagenateData(c_pagenate.start,c_pagenate.row);
bt_refresh.element.bind('dcmgrGUI.refresh', function(){ //Update list element c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/keypairs/list/', c_list.page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page, c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList', {request:list_request}) $.each(c_list.checked_list, function(check_id,obj){ //All remove detail element $($('#detail').find('#'+check_id)).remove(); //All reload detail element c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/keypairs/show/', check_id) },true); }); });
self.element.trigger('dcmgrGUI.configUpdatee',[self.id]);
self.element.trigger('dcmgrGUI.configUpdate',[self.id]);
DcmgrGUI.Detail.prototype.register_event('dcmgrGUI.afterUpdate',function(event,params){ var self = params.self; $('#detail').find('#update_'+self.id).live('click',function(){ $.ajax({ "type": "POST", "async": true, "url": '/security_groups/config', "data":"id="+self.id, "dataType": "json", success: function(json,status){ console.log(status); } }); }); self.element.trigger('dcmgrGUI.configUpdatee',[self.id]); });
var text = original+'<em>@<a href="'+jQuery(this).parent().children('a').get(0)+'">'+jQuery(this).parent().parent().parent().children('.threadauthor').children('p').children('strong').children('a').text()+'</a></em>\n\n';
var text = original+'<em>@<a href="'+jQuery(this).parent().children('a').get(0)+'">'+jQuery(this).parent().parent().parent().children('.threadauthor').children('p').children('strong').text()+'</a></em>\n\n';
jQuery(".reply_link").click(function () { var original = jQuery("#post_content").val(); if( original != ''){ original = original + '\n\n'; } var text = original+'<em>@<a href="'+jQuery(this).parent().children('a').get(0)+'">'+jQuery(this).parent().parent().parent().children('.threadauthor').children('p').children('strong').children('a').text()+'</a></em>\n\n'; jQuery("#post_content").val(text).focus(); jQuery(document).scrollTop(jQuery('#postform').offset().top) });
test("calls prepareContext() and sets layer to resulting element", function() {
test("calls renderToContext() and sets layer to resulting element", function() {
test("calls prepareContext() and sets layer to resulting element", function() { var v= SC.View.create({ tagName: 'span', prepareContext: function(context, firstTime) { context.push("foo"); } }); equals(v.get('layer'), null, 'precondition - has no layer'); v.createLayer(); var elem = v.get('layer'); ok(!!elem, 'has element now'); equals(elem.innerHTML, 'foo', 'has innerHTML from context'); equals(elem.tagName.toString().toLowerCase(), 'span', 'has tagName from view'); elem = null ;});
prepareContext: function(context, firstTime) {
renderToContext: function(context, firstTime) {
test("calls prepareContext() and sets layer to resulting element", function() { var v= SC.View.create({ tagName: 'span', prepareContext: function(context, firstTime) { context.push("foo"); } }); equals(v.get('layer'), null, 'precondition - has no layer'); v.createLayer(); var elem = v.get('layer'); ok(!!elem, 'has element now'); equals(elem.innerHTML, 'foo', 'has innerHTML from context'); equals(elem.tagName.toString().toLowerCase(), 'span', 'has tagName from view'); elem = null ;});
jQuery(this).prependTo('#comment-' + thisId + ' .submitted-on');
jQuery(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child');
jQuery('.akismet-status').each(function () { var thisId = jQuery(this).attr('commentid'); jQuery(this).prependTo('#comment-' + thisId + ' .submitted-on'); });
equals(selectedItem.title, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked');
equals(selectedItem ? selectedItem.title : null, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked');
test('Basic UI', function(){ menu.popup(); ok(menu.$().hasClass('sc-menu'), 'pane should have "sc-menu" class'); ok(menu.$().hasClass('sc-regular-size'), 'pane should have default control size class'); ok(!menu.get('isSubMenu'), 'isSubMenu should be NO on menus that are not submenus'); var menuItem = menu.get('menuItemViews')[0], selectedItem; menuItem.mouseEntered(); clickOn(menuItem, NO, NO); stop(); setTimeout(function() { selectedItem = menu.get('selectedItem'); ok(selectedItem, 'menu should have selectedItem property set after clicking on menu item'); equals(selectedItem.title, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked'); equals(1, menu._selectedItemCount, 'selectedItem should only change once when a menu item is clicked'); equals(1, menu._actionCount, 'action is fired once when menu item is clicked'); menu.remove(); ok(!menu.get('isVisibleInWindow'), 'menu should not be visible after being removed'); equals(menu.get('currentMenuItem'), null, 'currentMenuItem should be null after being removed'); start(); }, 250);});
["anchored", "compare", "editor", "_filter", "filterFunc", "keys", "_process", "top"].forEach(function (key)
["anchored", "compare", "editor", "inputField", "_filter", "filterFunc", "keys", "_process", "top"].forEach(function (key)
["anchored", "compare", "editor", "_filter", "filterFunc", "keys", "_process", "top"].forEach(function (key) self[key] = parent[key]);
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
tab.__defineGetter__("ordinal", function () Number(nodes.icon.value));
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
if (level < this.level || production) return; log.apply(log, [type, this.name].concat(Array.prototype.slice.call(arguments, 0)));
if (!production && level >= this.level) { log.apply(log, [type, this.name].concat(Array.prototype.slice.call(arguments, 0))); } return arguments[0];
return function() { if (level < this.level || production) return; log.apply(log, [type, this.name].concat(Array.prototype.slice.call(arguments, 0))); }
11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=
list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow)
list_request.data = DcmgrGUI.Util.getPagenateData(c_pagenate.start,c_pagenate.row);
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) //update detail $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/show/',check_id) },true); }); });
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
this.timeout(function () { dactyl.focusContent(true); }, 10);
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
); }
); });
$(this).each(function(){ $(this).hover( function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); } ); }
checkForCrashedTest();
Event.onDOMReady(function () { var checkboxes = Dom.get([ 'SET_failure', 'SET_success', 'SET_error', 'SET_skipped', 'SET_notimplemented', 'SET_testdox', 'SET_showMemoryAndTime' ]); for (var i = 0; i < checkboxes.length; i++) { var checkbox = checkboxes[i]; var display = checkbox.checked ? 'block' : 'none'; var className = mapClasses(checkbox.id); Dom.setStyle( Dom.getElementsByClassName(className), 'display', display ); } Event.addListener(checkboxes, 'click', toggle, this, true); Event.addListener('SET_codeCoverage', 'click', toggleCodeCoverage, this, true); }, this, true);
test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ;
test("check that testing without first time does not render to a context (no render needed)", function() {
test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); // test w/ firstTime context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); // test w/o firstTime runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');});
renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; }
layerId: "foo", classNames: ["bar"]
test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); // test w/ firstTime context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); // test w/o firstTime runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');});
context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');
ok(context.id() !== 'foo', 'did not set id'); ok(!context.hasClass('bar'), 'did not set class name');
test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); // test w/ firstTime context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); // test w/o firstTime runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');});
DcmgrGUI.Detail.prototype.register_event('dcmgrGUI.afterUpdate',function(event,params){ var self = params.self; $('#detail').find('#update_'+self.id).live('click',function(){
$('#detail').find('#update_'+self.id).live('click',function(){
DcmgrGUI.Detail.prototype.register_event('dcmgrGUI.afterUpdate',function(event,params){ var self = params.self; $('#detail').find('#update_'+self.id).live('click',function(){ $.ajax({ "type": "POST", "async": true, "url": '/security_groups/config', "data":"id="+self.id, "dataType": "json", success: function(json,status){ console.log(status); } }); }); self.element.trigger('dcmgrGUI.configUpdate',[self.id]); });
self.element.trigger('dcmgrGUI.configUpdate',[self.id]); });
DcmgrGUI.Detail.prototype.register_event('dcmgrGUI.afterUpdate',function(event,params){ var self = params.self; $('#detail').find('#update_'+self.id).live('click',function(){ $.ajax({ "type": "POST", "async": true, "url": '/security_groups/config', "data":"id="+self.id, "dataType": "json", success: function(json,status){ console.log(status); } }); }); self.element.trigger('dcmgrGUI.configUpdate',[self.id]); });
a+'"/>')});p(e.basefiles.concat(e.parserfile),function(a){/^https?:/.test(a)||(a=e.path+a);c.push('<script type="text/javascript" src="'+a+(e.noScriptCaching?"?nocache="+(new Date).getTime().toString(16):"")+'"><\/script>')});c.push('</head><body style="border-width: 0;" class="editbox" spellcheck="'+(e.disableSpellcheck?"false":"true")+'"></body></html>');return c.join("")}function o(e,c){this.options=c=c||{};i(c,CodeMirrorConfig);if(c.dumbTabs)c.tabMode="spaces";else if(c.normalTab)c.tabMode="default";
c+'"/>')});D(a.basefiles.concat(a.parserfile),function(c){/^https?:/.test(c)||(c=a.path+c);b.push('<script type="text/javascript" src="'+c+(a.noScriptCaching?"?nocache="+(new Date).getTime().toString(16):"")+'"><\/script>')});b.push('</head><body style="border-width: 0;" class="editbox" spellcheck="'+(a.disableSpellcheck?"false":"true")+'"></body></html>');return b.join("")}function s(a,b){this.options=b=b||{};C(b,CodeMirrorConfig);if(b.dumbTabs)b.tabMode="spaces";else if(b.normalTab)b.tabMode="default";
a+'"/>')});p(e.basefiles.concat(e.parserfile),function(a){/^https?:/.test(a)||(a=e.path+a);c.push('<script type="text/javascript" src="'+a+(e.noScriptCaching?"?nocache="+(new Date).getTime().toString(16):"")+'"><\/script>')});c.push('</head><body style="border-width: 0;" class="editbox" spellcheck="'+(e.disableSpellcheck?"false":"true")+'"></body></html>');return c.join("")}function o(e,c){this.options=c=c||{};i(c,CodeMirrorConfig);if(c.dumbTabs)c.tabMode="spaces";else if(c.normalTab)c.tabMode="default";
test("check that testing without first time does not render to a context (no render needed)", function() {
test("check that testing without first time still renders to a context", function() {
test("check that testing without first time does not render to a context (no render needed)", function() { var view = SC.View.create({ layerId: "foo", classNames: ["bar"], createRenderer: function(t) { return undefined; } }); var context = view.renderContext(); view.prepareContext(context, NO); // updating of view settings are now handled through CoreQuery, never // touching rendercontext, in the function updateViewSettings. ok(context.id() !== 'foo', 'did not set id'); ok(!context.hasClass('bar'), 'did not set class name');});
ok(context.id() !== 'foo', 'did not set id'); ok(!context.hasClass('bar'), 'did not set class name');
ok(context.id() === 'foo', 'set id'); ok(context.hasClass('bar'), 'set class name');
test("check that testing without first time does not render to a context (no render needed)", function() { var view = SC.View.create({ layerId: "foo", classNames: ["bar"], createRenderer: function(t) { return undefined; } }); var context = view.renderContext(); view.prepareContext(context, NO); // updating of view settings are now handled through CoreQuery, never // touching rendercontext, in the function updateViewSettings. ok(context.id() !== 'foo', 'did not set id'); ok(!context.hasClass('bar'), 'did not set class name');});
this.xform = (xformRules.length == 0) ? null : function (s) { $.each(xformRules, function (i_, r) { s = s.replace(r.pattern, r.repl); }); return s; };
var xformRules = $.map(this.getConfigList("TransformRule"), function (r) { var p = r.split(/\s+/); return {pattern: new RegExp(p[0], "g"), repl: p[1]}; });
this.xform = (xformRules.length == 0) ? null : function (s) { // apply transform rules $.each(xformRules, function (i_, r) { s = s.replace(r.pattern, r.repl); }); return s; };
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } else var editor = GetCurrentEditor(); if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); let lastUpdate = Date.now(); function update(force) { if (force !== true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now(); let val = tmpfile.read(); if (textBox) textBox.value = val; else { editor.selection.addRange(RangeFind.nodeRange(editor.rootNode)); editor.selection.deleteFromDocument(); editor.insertText(val); } } let timer = services.create("timer"); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path); } finally { timer.cancel(); } update(true); if (textBox) textBox.removeAttribute("readonly"); }, this);
text = Array.map(editor.rootElement.childNodes, function (e) util.domToString(e, true)).join("");
let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } else var editor = GetCurrentEditor(); if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); let lastUpdate = Date.now(); function update(force) { if (force !== true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now(); let val = tmpfile.read(); if (textBox) textBox.value = val; else { editor.selection.addRange(RangeFind.nodeRange(editor.rootNode)); editor.selection.deleteFromDocument(); editor.insertText(val); } } let timer = services.create("timer"); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path); } finally { timer.cancel(); } update(true); if (textBox) textBox.removeAttribute("readonly"); }, this);
$.each(c_list.checked_list,function(check_id,obj){
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ list_request.url = DcmgrGUI.Util.getPagePath('/images/show/',c_pagenate.current_page); c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){
$.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) },true); });
});
$.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) },true); });
var toggleButtonsIds = Dom.get(['SET[failure]', 'SET[success]', 'SET[error]', 'SET[skipped]', 'SET[notimplemented]', 'SET[testdox]', 'SET[showMemoryAndTime]']); for (var i = 0; i < toggleButtonsIds.length; i += 1) { var elm = toggleButtonsIds[i]; var display = elm.checked ? 'block' : 'none'; var className = mapClasses(elm.name); Dom.setStyle(Dom.getElementsByClassName(className), 'display', display);
var checkboxes = Dom.get([ 'SET_failure', 'SET_success', 'SET_error', 'SET_skipped', 'SET_notimplemented', 'SET_testdox', 'SET_showMemoryAndTime' ]); for (var i = 0; i < checkboxes.length; i++) { var checkbox = checkboxes[i]; var display = checkbox.checked ? 'block' : 'none'; var className = mapClasses(checkbox.id); Dom.setStyle( Dom.getElementsByClassName(className), 'display', display );
Event.onDOMReady(function () { var toggleButtonsIds = Dom.get(['SET[failure]', 'SET[success]', 'SET[error]', 'SET[skipped]', 'SET[notimplemented]', 'SET[testdox]', 'SET[showMemoryAndTime]']); for (var i = 0; i < toggleButtonsIds.length; i += 1) { var elm = toggleButtonsIds[i]; var display = elm.checked ? 'block' : 'none'; var className = mapClasses(elm.name); Dom.setStyle(Dom.getElementsByClassName(className), 'display', display); } Event.addListener(toggleButtonsIds, 'click', toggle, this, true); Event.addListener('SET[codeCoverage]', 'click', toggleCodeCoverage, this, true); }, this, true);
Event.addListener(toggleButtonsIds, 'click', toggle, this, true); Event.addListener('SET[codeCoverage]', 'click', toggleCodeCoverage, this, true);
Event.addListener(checkboxes, 'click', toggle, this, true); Event.addListener('SET_codeCoverage', 'click', toggleCodeCoverage, this, true);
Event.onDOMReady(function () { var toggleButtonsIds = Dom.get(['SET[failure]', 'SET[success]', 'SET[error]', 'SET[skipped]', 'SET[notimplemented]', 'SET[testdox]', 'SET[showMemoryAndTime]']); for (var i = 0; i < toggleButtonsIds.length; i += 1) { var elm = toggleButtonsIds[i]; var display = elm.checked ? 'block' : 'none'; var className = mapClasses(elm.name); Dom.setStyle(Dom.getElementsByClassName(className), 'display', display); } Event.addListener(toggleButtonsIds, 'click', toggle, this, true); Event.addListener('SET[codeCoverage]', 'click', toggleCodeCoverage, this, true); }, this, true);
bt_instance_stop.target.bind('click',function(){ bt_instance_stop.open(c_list.getCheckedInstanceIds());
bt_instance_start.target.bind('click',function(){ bt_instance_start.open(c_list.getCheckedInstanceIds());
bt_instance_stop.target.bind('click',function(){ bt_instance_stop.open(c_list.getCheckedInstanceIds()); });
if ($('#edit-vertical_tabs_example-enabled', context).attr('checked')) { return Drupal.checkPlain($('#edit-vertical_tabs_example-custom-setting', context).val());
if ($('#edit-vertical-tabs-example-enabled', context).attr('checked')) { return Drupal.checkPlain($('#edit-vertical-tabs-example-custom-setting', context).val());
$('fieldset.vertical_tabs_example-custom-form', context).setSummary(function (context) { // Depending on the checkbox status, the settings will be customized, so // update the summary with the custom setting textfield string or a use a // default string. if ($('#edit-vertical_tabs_example-enabled', context).attr('checked')) { return Drupal.checkPlain($('#edit-vertical_tabs_example-custom-setting', context).val()); } else { return Drupal.t('Using default.'); } });
return Drupal.t('Using default.');
return Drupal.t('Using default');
$('fieldset.vertical_tabs_example-custom-form', context).setSummary(function (context) { // Depending on the checkbox status, the settings will be customized, so // update the summary with the custom setting textfield string or a use a // default string. if ($('#edit-vertical_tabs_example-enabled', context).attr('checked')) { return Drupal.checkPlain($('#edit-vertical_tabs_example-custom-setting', context).val()); } else { return Drupal.t('Using default.'); } });
$('fieldset#edit-path', context).drupalSetSummary(function (context) { var path = $('#edit-path-alias').val(); var automatic = $('#edit-path-pathauto-perform-alias').attr('checked');
$('fieldset.path-form', context).drupalSetSummary(function (context) { var path = $('.form-item-path-alias input').val(); var automatic = $('.form-item-path-pathauto input').attr('checked');
$('fieldset#edit-path', context).drupalSetSummary(function (context) { var path = $('#edit-path-alias').val(); var automatic = $('#edit-path-pathauto-perform-alias').attr('checked'); if (automatic) { return Drupal.t('Automatic alias'); } if (path) { return Drupal.t('Alias: @alias', { '@alias': path }); } else { return Drupal.t('No alias'); } });