rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; }
if (value !== undefined && !isClick) { e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } }
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() {
var speed = isClick ? conf.speed : 0, fn = isClick ? function() {
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
handle.animate({top: -(x - len)}, speed, callback);
handle.animate({top: -(x - len)}, speed, fn);
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
handle.animate({left: x}, speed, callback);
handle.animate({left: x}, speed, fn);
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
if (!val || val == value) { return self; }
if (val === NaN || val == value) { return self; }
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
self.setValue(input.val() || conf.min);
self.setValue(input.val() || conf.value || conf.min);
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
var el = this.data("slideshow"), len = this.length;
var el = this.data("slideshow");
$.fn.slideshow = function(conf) { // return existing instance var el = this.data("slideshow"), len = this.length; if (el) { return el; } conf = $.extend({}, tool.conf, conf); this.each(function() { el = new Slideshow($(this), conf, len); $(this).data("slideshow", el); }); return conf.api ? el : this; };
el = new Slideshow($(this), conf, len);
el = new Slideshow($(this), conf);
$.fn.slideshow = function(conf) { // return existing instance var el = this.data("slideshow"), len = this.length; if (el) { return el; } conf = $.extend({}, tool.conf, conf); this.each(function() { el = new Slideshow($(this), conf, len); $(this).data("slideshow", el); }); return conf.api ? el : this; };
function Slideshow(root, conf, len) {
function Slideshow(root, conf) {
function Slideshow(root, conf, len) { var self = this, fire = root.add(this), tabs = root.data("tabs"), timer, hoverTimer, startTimer, stopped = false; // next / prev buttons function find(query) { return len == 1 ? $(query) : root.parent().find(query); } var nextButton = find(conf.next).click(function() { tabs.next(); }); var prevButton = find(conf.prev).click(function() { tabs.prev(); }); // extend the Tabs API with slideshow methods $.extend(self, { // return tabs API getTabs: function() { return tabs; }, getConf: function() { return conf; }, play: function() { // do not start additional timer if already exists if (timer) { return; } // onBeforePlay var e = $.Event("onBeforePlay"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } stopped = false; // construct new timer timer = setInterval(tabs.next, conf.interval); // onPlay fire.trigger("onPlay"); tabs.next(); }, pause: function() { if (!timer) { return self; } // onBeforePause var e = $.Event("onBeforePause"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } timer = clearInterval(timer); startTimer = clearInterval(startTimer); // onPause fire.trigger("onPause"); }, // when stopped - mouseover won't restart stop: function() { self.pause(); stopped = true; } }); // callbacks $.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); /* when mouse enters, slideshow stops */ if (conf.autopause) { var els = tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()); els.hover(function() { self.pause(); hoverTimer = clearInterval(hoverTimer); }, function() { if (!stopped) { hoverTimer = setTimeout(self.play, conf.interval); } }); } if (conf.autoplay) { startTimer = setTimeout(self.play, conf.interval); } else { self.stop(); } if (conf.clickable) { tabs.getPanes().click(function() { tabs.next(); }); } // manage disabling of next/prev buttons if (!tabs.getConf().rotate) { var cls = conf.disabledClass; if (!tabs.getIndex()) { prevButton.addClass(cls); } tabs.onBeforeClick(function(e, i) { if (!i) { prevButton.addClass(cls); } else { prevButton.removeClass(cls); if (i == tabs.getTabs().length -1) { nextButton.addClass(cls); } else { nextButton.removeClass(cls); } } }); } }
return len == 1 ? $(query) : root.parent().find(query);
var el = $(query); return el.length < 2 ? el : root.parent().find(query);
function Slideshow(root, conf, len) { var self = this, fire = root.add(this), tabs = root.data("tabs"), timer, hoverTimer, startTimer, stopped = false; // next / prev buttons function find(query) { return len == 1 ? $(query) : root.parent().find(query); } var nextButton = find(conf.next).click(function() { tabs.next(); }); var prevButton = find(conf.prev).click(function() { tabs.prev(); }); // extend the Tabs API with slideshow methods $.extend(self, { // return tabs API getTabs: function() { return tabs; }, getConf: function() { return conf; }, play: function() { // do not start additional timer if already exists if (timer) { return; } // onBeforePlay var e = $.Event("onBeforePlay"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } stopped = false; // construct new timer timer = setInterval(tabs.next, conf.interval); // onPlay fire.trigger("onPlay"); tabs.next(); }, pause: function() { if (!timer) { return self; } // onBeforePause var e = $.Event("onBeforePause"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } timer = clearInterval(timer); startTimer = clearInterval(startTimer); // onPause fire.trigger("onPause"); }, // when stopped - mouseover won't restart stop: function() { self.pause(); stopped = true; } }); // callbacks $.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); /* when mouse enters, slideshow stops */ if (conf.autopause) { var els = tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()); els.hover(function() { self.pause(); hoverTimer = clearInterval(hoverTimer); }, function() { if (!stopped) { hoverTimer = setTimeout(self.play, conf.interval); } }); } if (conf.autoplay) { startTimer = setTimeout(self.play, conf.interval); } else { self.stop(); } if (conf.clickable) { tabs.getPanes().click(function() { tabs.next(); }); } // manage disabling of next/prev buttons if (!tabs.getConf().rotate) { var cls = conf.disabledClass; if (!tabs.getIndex()) { prevButton.addClass(cls); } tabs.onBeforeClick(function(e, i) { if (!i) { prevButton.addClass(cls); } else { prevButton.removeClass(cls); if (i == tabs.getTabs().length -1) { nextButton.addClass(cls); } else { nextButton.removeClass(cls); } } }); } }
play: function() {
play: function() {http:
function Slideshow(root, conf, len) { var self = this, fire = root.add(this), tabs = root.data("tabs"), timer, hoverTimer, startTimer, stopped = false; // next / prev buttons function find(query) { return len == 1 ? $(query) : root.parent().find(query); } var nextButton = find(conf.next).click(function() { tabs.next(); }); var prevButton = find(conf.prev).click(function() { tabs.prev(); }); // extend the Tabs API with slideshow methods $.extend(self, { // return tabs API getTabs: function() { return tabs; }, play: function() { // do not start additional timer if already exists if (timer) { return; } // onBeforePlay var e = $.Event("onBeforePlay"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } stopped = false; // construct new timer timer = setInterval(tabs.next, conf.interval); // onPlay fire.trigger("onPlay"); tabs.next(); }, pause: function() { if (!timer) { return self; } // onBeforePause var e = $.Event("onBeforePause"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } timer = clearInterval(timer); startTimer = clearInterval(startTimer); // onPause fire.trigger("onPause"); }, // when stopped - mouseover won't restart stop: function() { self.pause(); stopped = true; }, bind: function(name, fn) { $(self).bind(name, fn); return self; }, unbind: function(name) { $(self).unbind(name); return self; } }); // callbacks $.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); /* when mouse enters, slideshow stops */ if (conf.autopause) { var els = tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()); els.hover(function() { self.pause(); hoverTimer = clearInterval(hoverTimer); }, function() { if (!stopped) { hoverTimer = setTimeout(self.play, conf.interval); } }); } if (conf.autoplay) { startTimer = setTimeout(self.play, conf.interval); } else { self.stop(); } if (conf.clickable) { tabs.getPanes().click(function() { tabs.next(); }); } // manage disabling of next/prev buttons if (!tabs.getConf().rotate) { var cls = conf.disabledClass; if (!tabs.getIndex()) { prevButton.addClass(cls); } tabs.onBeforeClick(function(e, i) { if (!i) { prevButton.addClass(cls); } else { prevButton.removeClass(cls); if (i == tabs.getTabs().length -1) { nextButton.addClass(cls); } else { nextButton.removeClass(cls); } } }); } }
}, bind: function(name, fn) { $(self).bind(name, fn); return self; }, unbind: function(name) { $(self).unbind(name); return self;
function Slideshow(root, conf, len) { var self = this, fire = root.add(this), tabs = root.data("tabs"), timer, hoverTimer, startTimer, stopped = false; // next / prev buttons function find(query) { return len == 1 ? $(query) : root.parent().find(query); } var nextButton = find(conf.next).click(function() { tabs.next(); }); var prevButton = find(conf.prev).click(function() { tabs.prev(); }); // extend the Tabs API with slideshow methods $.extend(self, { // return tabs API getTabs: function() { return tabs; }, play: function() { // do not start additional timer if already exists if (timer) { return; } // onBeforePlay var e = $.Event("onBeforePlay"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } stopped = false; // construct new timer timer = setInterval(tabs.next, conf.interval); // onPlay fire.trigger("onPlay"); tabs.next(); }, pause: function() { if (!timer) { return self; } // onBeforePause var e = $.Event("onBeforePause"); fire.trigger(e); if (e.isDefaultPrevented()) { return self; } timer = clearInterval(timer); startTimer = clearInterval(startTimer); // onPause fire.trigger("onPause"); }, // when stopped - mouseover won't restart stop: function() { self.pause(); stopped = true; }, bind: function(name, fn) { $(self).bind(name, fn); return self; }, unbind: function(name) { $(self).unbind(name); return self; } }); // callbacks $.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); /* when mouse enters, slideshow stops */ if (conf.autopause) { var els = tabs.getTabs().add(nextButton).add(prevButton).add(tabs.getPanes()); els.hover(function() { self.pause(); hoverTimer = clearInterval(hoverTimer); }, function() { if (!stopped) { hoverTimer = setTimeout(self.play, conf.interval); } }); } if (conf.autoplay) { startTimer = setTimeout(self.play, conf.interval); } else { self.stop(); } if (conf.clickable) { tabs.getPanes().click(function() { tabs.next(); }); } // manage disabling of next/prev buttons if (!tabs.getConf().rotate) { var cls = conf.disabledClass; if (!tabs.getIndex()) { prevButton.addClass(cls); } tabs.onBeforeClick(function(e, i) { if (!i) { prevButton.addClass(cls); } else { prevButton.removeClass(cls); if (i == tabs.getTabs().length -1) { nextButton.addClass(cls); } else { nextButton.removeClass(cls); } } }); } }
$.ajax({ url: '/frontend/ajax.php?module=search&action=autocomplete&language=' + chunks[1],
$.ajax({ url: '/frontend/ajax.php?module=search&action=autocomplete',
source: function(request, response) { $.ajax({ url: '/frontend/ajax.php?module=search&action=autocomplete&language=' + chunks[1], type: 'GET', data: 'term=' + request.term + '&language=' + chunks[1] + '&limit=' + limit, success: function(data, textStatus) { // init var var realData = []; // alert the user if(data.code != 200 && jsFrontend.debug) { alert(data.message); } if(data.code == 200) { for(var i in data.data) realData.push({ label: data.data[i].term, value: data.data[i].term }); } // set response response(realData); } }); }
x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=this.clone();
x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])t=t.getParent(),u=t.getIndex();v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])t=t.getParent(),u=t.getIndex()+1;v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2); var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=u==1,w=this.clone();w.collapse(v);w[v?'setStartAt':'setEndAt'](t,v?1:2);var x=new d.walker(w);x.evaluator=p;return x[v?'checkBackward':'checkForward']();},checkStartOfBlock:function(){var z=this;var t=z.startContainer,u=z.startOffset;if(u&&t.type==3){var v=e.ltrim(t.substring(0,u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.startContainer),x=z.clone();x.collapse(true);x.setStartAt(w.block||w.blockLimit,1);var y=new d.walker(x);y.evaluator=o(true);return y.checkBackward();},checkEndOfBlock:function(){var z=this;var t=z.endContainer,u=z.endOffset;if(t.type==3){var v=e.rtrim(t.substring(u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.endContainer),x=z.clone();x.collapse(false);x.setEndAt(w.block||w.blockLimit,2);var y=new d.walker(x);y.evaluator=o(false);return y.checkForward();},moveToElementEditablePosition:function(t,u){var v;if(f.$empty[t.getName()])return false;while(t&&t.type==1){v=t.isEditable();if(v)this.moveToPosition(t,u?2:1);else if(f.$inline[t.getName()]){this.moveToPosition(t,u?4:3);return true;}if(f.$empty[t.getName()])t=t[u?'getPrevious':'getNext'](s);else t=t[u?'getLast':'getFirst'](s);if(t&&t.type==3){this.moveToPosition(t,u?4:3);return true;}}return v;},moveToElementEditStart:function(t){return this.moveToElementEditablePosition(t);},moveToElementEditEnd:function(t){return this.moveToElementEditablePosition(t,true);},getEnclosedNode:function(){var t=this.clone();t.optimize();if(t.startContainer.type!=1||t.endContainer.type!=1)return null;var u=new d.walker(t),v=d.walker.bookmark(true),w=d.walker.whitespaces(true),x=function(z){return w(z)&&v(z);};t.evaluator=x;var y=u.next();u.reset();return y&&y.equals(u.previous())?y:null;},getTouchedStartNode:function(){var t=this.startContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.startOffset)||t;},getTouchedEndNode:function(){var t=this.endContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.endOffset-1)||t;}};})();a.POSITION_AFTER_START=1;a.POSITION_BEFORE_END=2;a.POSITION_BEFORE_START=3;a.POSITION_AFTER_END=4;a.ENLARGE_ELEMENT=1;a.ENLARGE_BLOCK_CONTENTS=2;a.ENLARGE_LIST_ITEM_CONTENTS=3;a.START=1;a.END=2;a.STARTEND=3;a.SHRINK_ELEMENT=1;a.SHRINK_TEXT=2;(function(){d.rangeList=function(n){if(n instanceof d.rangeList)return n;if(!n)n=[];else if(n instanceof d.range)n=[n];return e.extend(n,l);
x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=this.clone();
while (leftSplitValue < 0 && leftSplit[left] > 0)
while (leftSplitValue < 0 && leftSplit[left] > 0) {
var splitter = function (left, right, value, splits) { var newSplits = []; for (var i = 0; i < splits.length; i++) { var bbox = splits[i]; var leftSplit = bbox.clone(); var rightSplit = bbox.clone(); //If we split across a range that sees a sign flip //ensure the sign across each split rectangle is equal var leftSplitValue = value; while (leftSplitValue < 0 && leftSplit[left] > 0) leftSplitValue += 360; while (leftSplitValue > 0 && leftSplit[left] < 0) leftSplitValue -= 360; var rightSplitValue = value; while (rightSplitValue < 0 && rightSplit[right] > 0) rightSplitValue += 360; while (rightSplitValue > 0 && rightSplit[right] < 0) rightSplitValue -= 360; leftSplit[left] = bbox[left]; leftSplit[right] = leftSplitValue; rightSplit[left] = rightSplitValue; rightSplit[right] = bbox[right]; newSplits.push(leftSplit); newSplits.push(rightSplit); } return newSplits; };
while (leftSplitValue > 0 && leftSplit[left] < 0)
} while (leftSplitValue > 0 && leftSplit[left] < 0) {
var splitter = function (left, right, value, splits) { var newSplits = []; for (var i = 0; i < splits.length; i++) { var bbox = splits[i]; var leftSplit = bbox.clone(); var rightSplit = bbox.clone(); //If we split across a range that sees a sign flip //ensure the sign across each split rectangle is equal var leftSplitValue = value; while (leftSplitValue < 0 && leftSplit[left] > 0) leftSplitValue += 360; while (leftSplitValue > 0 && leftSplit[left] < 0) leftSplitValue -= 360; var rightSplitValue = value; while (rightSplitValue < 0 && rightSplit[right] > 0) rightSplitValue += 360; while (rightSplitValue > 0 && rightSplit[right] < 0) rightSplitValue -= 360; leftSplit[left] = bbox[left]; leftSplit[right] = leftSplitValue; rightSplit[left] = rightSplitValue; rightSplit[right] = bbox[right]; newSplits.push(leftSplit); newSplits.push(rightSplit); } return newSplits; };
while (rightSplitValue < 0 && rightSplit[right] > 0)
while (rightSplitValue < 0 && rightSplit[right] > 0) {
var splitter = function (left, right, value, splits) { var newSplits = []; for (var i = 0; i < splits.length; i++) { var bbox = splits[i]; var leftSplit = bbox.clone(); var rightSplit = bbox.clone(); //If we split across a range that sees a sign flip //ensure the sign across each split rectangle is equal var leftSplitValue = value; while (leftSplitValue < 0 && leftSplit[left] > 0) leftSplitValue += 360; while (leftSplitValue > 0 && leftSplit[left] < 0) leftSplitValue -= 360; var rightSplitValue = value; while (rightSplitValue < 0 && rightSplit[right] > 0) rightSplitValue += 360; while (rightSplitValue > 0 && rightSplit[right] < 0) rightSplitValue -= 360; leftSplit[left] = bbox[left]; leftSplit[right] = leftSplitValue; rightSplit[left] = rightSplitValue; rightSplit[right] = bbox[right]; newSplits.push(leftSplit); newSplits.push(rightSplit); } return newSplits; };
while (rightSplitValue > 0 && rightSplit[right] < 0)
} while (rightSplitValue > 0 && rightSplit[right] < 0) {
var splitter = function (left, right, value, splits) { var newSplits = []; for (var i = 0; i < splits.length; i++) { var bbox = splits[i]; var leftSplit = bbox.clone(); var rightSplit = bbox.clone(); //If we split across a range that sees a sign flip //ensure the sign across each split rectangle is equal var leftSplitValue = value; while (leftSplitValue < 0 && leftSplit[left] > 0) leftSplitValue += 360; while (leftSplitValue > 0 && leftSplit[left] < 0) leftSplitValue -= 360; var rightSplitValue = value; while (rightSplitValue < 0 && rightSplit[right] > 0) rightSplitValue += 360; while (rightSplitValue > 0 && rightSplit[right] < 0) rightSplitValue -= 360; leftSplit[left] = bbox[left]; leftSplit[right] = leftSplitValue; rightSplit[left] = rightSplitValue; rightSplit[right] = bbox[right]; newSplits.push(leftSplit); newSplits.push(rightSplit); } return newSplits; };
}
var splitter = function (left, right, value, splits) { var newSplits = []; for (var i = 0; i < splits.length; i++) { var bbox = splits[i]; var leftSplit = bbox.clone(); var rightSplit = bbox.clone(); //If we split across a range that sees a sign flip //ensure the sign across each split rectangle is equal var leftSplitValue = value; while (leftSplitValue < 0 && leftSplit[left] > 0) leftSplitValue += 360; while (leftSplitValue > 0 && leftSplit[left] < 0) leftSplitValue -= 360; var rightSplitValue = value; while (rightSplitValue < 0 && rightSplit[right] > 0) rightSplitValue += 360; while (rightSplitValue > 0 && rightSplit[right] < 0) rightSplitValue -= 360; leftSplit[left] = bbox[left]; leftSplit[right] = leftSplitValue; rightSplit[left] = rightSplitValue; rightSplit[right] = bbox[right]; newSplits.push(leftSplit); newSplits.push(rightSplit); } return newSplits; };
if (!fullPoll) { fullPoll=true; pollRequest.post(myRequestOptions); }
if (fullPoll < 2) { fullPoll= 2; if(Browser.Engine.trident && Browser.Engine.version == 5) { pollRequest.transmit({'lid':lastId+1}); } else { pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); } }
start : function () { if (!fullPoll) { fullPoll=true; pollRequest.post(myRequestOptions); } },
if (fullPoll < 2) { fullPoll= 2;
if (fullPoll == 0) {
start : function () { if (fullPoll < 2) { fullPoll= 2; pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); } },
fullPoll= 2;
start : function () { if (fullPoll < 2) { fullPoll= 2; pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); } },
if (fullPoll < 2) { fullPoll= 2; if(Browser.Engine.trident && Browser.Engine.version == 5) { pollRequest.transmit({'lid':lastId+1}); } else { pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); }
if (fullPoll == 0) { pollRequest.post($merge(myRequestOptions,{'lid':lastId+1}));
start : function () { if (fullPoll < 2) { fullPoll= 2; if(Browser.Engine.trident && Browser.Engine.version == 5) { pollRequest.transmit({'lid':lastId+1}); } else { pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); } } },
fullPoll= 2;
start : function () { if (fullPoll < 2) { fullPoll= 2; if(Browser.Engine.trident && Browser.Engine.version == 5) { pollRequest.transmit({'lid':lastId+1}); } else { pollRequest.post($merge(myRequestOptions,{'lid':lastId+1})); } } },
findABC($("body")).each(function(i,elem){
getABCContainingElements($("body")).each(function(i,elem){
function start_abc() { // var userlogout = $("a.mainmenu:last").text();// if (userlogout == "Connexion") {// //GM_log("User not logged in");// return;// }// var username = /\[\s(.*)\s\]/.exec(userlogout)[1]; // if (username != "Tirno") {// return;// } abc_plugin_errors=""; findABC($("body")).each(function(i,elem){ ABCConversion(elem); }); }
if (this.nextTab()) { this.nextTab().activate();
var nextTab = this.menu.activeTab.nextTab(); if (nextTab) { nextTab.activate();
startAutoPlay: function() { this.stopAutoPlay(); this.parent.autoPlayerTimer = setTimeout(function() { if (this.nextTab()) { this.nextTab().activate(); } }.bind(this), this.parent.options.autoPlayDelay); },
This.appendStartingElement('clef', params.startChar, params.endChar, {type: params.clef });
This.appendStartingElement('clef', params.startChar, params.endChar, params.clef );
startNewLine: function(params) { // If the pointed to line doesn't exist, just create that. If the line does exist, but doesn't have any music on it, just use it. // If it does exist and has music, then increment the line number. If the new element doesn't exist, create it. var This = this; var createVoice = function(params) { This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = []; if (params.part) This.appendElement('part', params.startChar, params.endChar, {title: params.part}); This.appendStartingElement('clef', params.startChar, params.endChar, {type: params.clef }); This.appendStartingElement('key', params.startChar, params.endChar, params.key); if (params.meter !== undefined) This.appendStartingElement('meter', params.startChar, params.endChar, params.meter); }; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = { voices: [ ]}; if (params.name) this.lines[This.lineNum].staff[This.staffNum].title = params.name; createVoice(params); }; var createLine = function(params) { This.lines[This.lineNum] = { staff: [] }; createStaff(params); }; if (this.lines[this.lineNum] === undefined) createLine(params); else if (this.lines[this.lineNum].staff === undefined) { this.lineNum++; this.startNewLine(params); } else if (this.lines[this.lineNum].staff[this.staffNum] === undefined) createStaff(params); else if (this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum] === undefined) createVoice(params); else if (!this.containsNotes(this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum])) return; else { this.lineNum++; this.startNewLine(params); } },
if (params.name) this.lines[This.lineNum].staff[This.staffNum].title = params.name;
if (params.name) This.lines[This.lineNum].staff[This.staffNum].title = params.name; if (params.fontVocal) This.lines[This.lineNum].staff[This.staffNum].fontVocal = params.fontVocal;
startNewLine: function(params) { // If the pointed to line doesn't exist, just create that. If the line does exist, but doesn't have any music on it, just use it. // If it does exist and has music, then increment the line number. If the new element doesn't exist, create it. var This = this; var createVoice = function(params) { This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = []; if (params.part) This.appendElement('part', params.startChar, params.endChar, {title: params.part}); This.appendStartingElement('clef', params.startChar, params.endChar, {type: params.clef }); This.appendStartingElement('key', params.startChar, params.endChar, params.key); if (params.meter !== undefined) This.appendStartingElement('meter', params.startChar, params.endChar, params.meter); }; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = { voices: [ ]}; if (params.name) this.lines[This.lineNum].staff[This.staffNum].title = params.name; createVoice(params); }; var createLine = function(params) { This.lines[This.lineNum] = { staff: [] }; createStaff(params); }; if (this.lines[this.lineNum] === undefined) createLine(params); else if (this.lines[this.lineNum].staff === undefined) { this.lineNum++; this.startNewLine(params); } else if (this.lines[this.lineNum].staff[this.staffNum] === undefined) createStaff(params); else if (this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum] === undefined) createVoice(params); else if (!this.containsNotes(this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum])) return; else { this.lineNum++; this.startNewLine(params); } },
}; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = { voices: [ ]}; if (params.name) This.lines[This.lineNum].staff[This.staffNum].title = params.name; if (params.fontVocal) This.lines[This.lineNum].staff[This.staffNum].fontVocal = params.fontVocal; createVoice(params);
startNewLine: function(params) { // If the pointed to line doesn't exist, just create that. If the line does exist, but doesn't have any music on it, just use it. // If it does exist and has music, then increment the line number. If the new element doesn't exist, create it. var This = this; var createVoice = function(params) { This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = []; if (params.part) This.appendElement('part', params.startChar, params.endChar, {title: params.part}); This.appendStartingElement('clef', params.startChar, params.endChar, params.clef ); This.appendStartingElement('key', params.startChar, params.endChar, params.key); if (params.meter !== undefined) This.appendStartingElement('meter', params.startChar, params.endChar, params.meter); }; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = { voices: [ ]}; if (params.name) This.lines[This.lineNum].staff[This.staffNum].title = params.name; if (params.fontVocal) This.lines[This.lineNum].staff[This.staffNum].fontVocal = params.fontVocal; createVoice(params); }; var createLine = function(params) { This.lines[This.lineNum] = { staff: [] }; createStaff(params); }; if (this.lines[this.lineNum] === undefined) createLine(params); else if (this.lines[this.lineNum].staff === undefined) { this.lineNum++; this.startNewLine(params); } else if (this.lines[this.lineNum].staff[this.staffNum] === undefined) createStaff(params); else if (this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum] === undefined) createVoice(params); else if (!this.containsNotes(this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum])) return; else { this.lineNum++; this.startNewLine(params); } },
startNewLine: function(params) {
this.startNewLine = function(params) {
startNewLine: function(params) { // If the pointed to line doesn't exist, just create that. If the line does exist, but doesn't have any music on it, just use it. // If it does exist and has music, then increment the line number. If the new element doesn't exist, create it. var This = this; var createVoice = function(params) { This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = []; if (This.isFirstLine(This.lineNum)) { if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.staffNum].title[This.voiceNum] = params.name;} } else { if (params.subname) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.staffNum].title[This.voiceNum] = params.subname;} } if (params.stem) This.appendElement('stem', -1, -1, {direction: params.stem}); else if (This.voiceNum > 0) { if (This.lines[This.lineNum].staff[This.staffNum].voices[0]!== undefined) { var found = false; for (var i = 0; i < This.lines[This.lineNum].staff[This.staffNum].voices[0].length; i++) { if (This.lines[This.lineNum].staff[This.staffNum].voices[0].el_type === 'stem') found = true; } if (!found) { var stem = { el_type: 'stem', startChar: -1, endChar: -1, direction: 'up' }; This.lines[This.lineNum].staff[This.staffNum].voices[0].splice(0,0,stem); } } This.appendElement('stem', -1, -1, {direction: 'down'}); } }; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = {voices: [ ], clef: params.clef, key: params.key}; if (params.vocalfont) This.lines[This.lineNum].staff[This.staffNum].vocalfont = params.vocalfont; if (params.bracket) This.lines[This.lineNum].staff[This.staffNum].bracket = params.bracket; if (params.brace) This.lines[This.lineNum].staff[This.staffNum].brace = params.brace; if (params.connectBarLines) This.lines[This.lineNum].staff[This.staffNum].connectBarLines = params.connectBarLines; createVoice(params); // Some stuff just happens for the first voice if (params.part) This.appendElement('part', params.startChar, params.endChar, {title: params.part}); if (params.meter !== undefined) This.lines[This.lineNum].staff[This.staffNum].meter = params.meter; }; var createLine = function(params) { This.lines[This.lineNum] = {staff: []}; createStaff(params); }; if (this.lines[this.lineNum] === undefined) createLine(params); else if (this.lines[this.lineNum].staff === undefined) { this.lineNum++; this.startNewLine(params); } else if (this.lines[this.lineNum].staff[this.staffNum] === undefined) createStaff(params); else if (this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum] === undefined) createVoice(params); else if (!this.containsNotes(this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum])) return; else { this.lineNum++; this.startNewLine(params); } },
},
};
startNewLine: function(params) { // If the pointed to line doesn't exist, just create that. If the line does exist, but doesn't have any music on it, just use it. // If it does exist and has music, then increment the line number. If the new element doesn't exist, create it. var This = this; var createVoice = function(params) { This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = []; if (This.isFirstLine(This.lineNum)) { if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.staffNum].title[This.voiceNum] = params.name;} } else { if (params.subname) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.staffNum].title[This.voiceNum] = params.subname;} } if (params.stem) This.appendElement('stem', -1, -1, {direction: params.stem}); else if (This.voiceNum > 0) { if (This.lines[This.lineNum].staff[This.staffNum].voices[0]!== undefined) { var found = false; for (var i = 0; i < This.lines[This.lineNum].staff[This.staffNum].voices[0].length; i++) { if (This.lines[This.lineNum].staff[This.staffNum].voices[0].el_type === 'stem') found = true; } if (!found) { var stem = { el_type: 'stem', startChar: -1, endChar: -1, direction: 'up' }; This.lines[This.lineNum].staff[This.staffNum].voices[0].splice(0,0,stem); } } This.appendElement('stem', -1, -1, {direction: 'down'}); } }; var createStaff = function(params) { This.lines[This.lineNum].staff[This.staffNum] = {voices: [ ], clef: params.clef, key: params.key}; if (params.vocalfont) This.lines[This.lineNum].staff[This.staffNum].vocalfont = params.vocalfont; if (params.bracket) This.lines[This.lineNum].staff[This.staffNum].bracket = params.bracket; if (params.brace) This.lines[This.lineNum].staff[This.staffNum].brace = params.brace; if (params.connectBarLines) This.lines[This.lineNum].staff[This.staffNum].connectBarLines = params.connectBarLines; createVoice(params); // Some stuff just happens for the first voice if (params.part) This.appendElement('part', params.startChar, params.endChar, {title: params.part}); if (params.meter !== undefined) This.lines[This.lineNum].staff[This.staffNum].meter = params.meter; }; var createLine = function(params) { This.lines[This.lineNum] = {staff: []}; createStaff(params); }; if (this.lines[this.lineNum] === undefined) createLine(params); else if (this.lines[this.lineNum].staff === undefined) { this.lineNum++; this.startNewLine(params); } else if (this.lines[this.lineNum].staff[this.staffNum] === undefined) createStaff(params); else if (this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum] === undefined) createVoice(params); else if (!this.containsNotes(this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum])) return; else { this.lineNum++; this.startNewLine(params); } },
if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber;
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part =multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.currentVoice.clef !== undefined ? multilineVars.currentVoice.clef : multilineVars.clef ; params.key = multilineVars.key; if (multilineVars.meter !== null) params.meter = multilineVars.meter; if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; tune.startNewLine(params); multilineVars.partForNextLine = ""; multilineVars.meter = null; }
var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) {
var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; });
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { // Make sure that each voice gets the meter marking. params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params); multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { //multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } }
} if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params);
} else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params);
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { // Make sure that each voice gets the meter marking. params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params); multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { //multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } }
multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; }
multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber;
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { // Make sure that each voice gets the meter marking. params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params); multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { //multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } }
}
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { // Make sure that each voice gets the meter marking. params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params); multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { //multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } }
if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; }
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part =multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.currentVoice.clef !== undefined ? multilineVars.currentVoice.clef : multilineVars.clef ; params.key = multilineVars.key; if (multilineVars.meter !== null) params.meter = multilineVars.meter; if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.fontVocal) params.fontVocal = multilineVars.fontVocal; tune.startNewLine(params); multilineVars.partForNextLine = ""; multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; }
params.key = Object.clone(multilineVars.key);
params.key = header.deepCopyKey(multilineVars.key.accidentals);
function startNewLine() { var params = { startChar: -1, endChar: -1}; if (multilineVars.partForNextLine.length) params.part = multilineVars.partForNextLine; params.clef = multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].clef !== undefined ? multilineVars.staves[multilineVars.currentVoice.staffNum].clef : multilineVars.clef ; params.key = Object.clone(multilineVars.key); header.addPosToKey(params.clef, params.key); if (multilineVars.meter !== null) { if (multilineVars.currentVoice) { multilineVars.staves.each(function(st) { st.meter = multilineVars.meter; }); params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } else params.meter = multilineVars.meter; multilineVars.meter = null; } else if (multilineVars.currentVoice && multilineVars.staves[multilineVars.currentVoice.staffNum].meter) { // Make sure that each voice gets the meter marking. params.meter = multilineVars.staves[multilineVars.currentVoice.staffNum].meter; multilineVars.staves[multilineVars.currentVoice.staffNum].meter = null; } if (multilineVars.currentVoice && multilineVars.currentVoice.name) params.name = multilineVars.currentVoice.name; if (multilineVars.vocalfont) params.vocalfont = multilineVars.vocalfont; if (multilineVars.currentVoice) { var staff = multilineVars.staves[multilineVars.currentVoice.staffNum]; if (staff.brace) params.brace = staff.brace; if (staff.bracket) params.bracket = staff.bracket; if (staff.connectBarLines) params.connectBarLines = staff.connectBarLines; if (staff.name) params.name = staff.name[multilineVars.currentVoice.index]; if (staff.subname) params.subname = staff.subname[multilineVars.currentVoice.index]; if (multilineVars.currentVoice.stem) params.stem = multilineVars.currentVoice.stem; } tune.startNewLine(params); multilineVars.partForNextLine = ""; if (multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === multilineVars.staves.length-1 && multilineVars.staves[multilineVars.currentVoice.staffNum].numVoices-1 === multilineVars.currentVoice.index)) { //multilineVars.meter = null; if (multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } }
this.bookmarkable = true;
startSearch : function(panel, updateHistory) { this.bookmarkable = true; if (updateHistory) { // update history in address bar of browser Sonatype.utils.updateHistory(panel); } var searchType = this.getSearchType(this.searchTypeButton.value); searchType.searchHandler.call(this, panel); },
panel.extraData = null;
startSearch : function(panel, updateHistory) { if (updateHistory) { // update history in address bar of browser Sonatype.utils.updateHistory(panel); } var searchType = this.getSearchType(this.searchTypeButton.value); if ( panel.grid.store.sortInfo ) { panel.grid.store.sortInfo = null; panel.grid.getView().updateHeaders(); } searchType.searchHandler.call(this, panel); },
if (keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { keeFoxInst._KFLog.debug("Setup has already been done but we will make sure that the window that this scope is a part of has been set up to properly reflect KeeFox status"); keeFoxInst._refreshKPDB(); return;
if (keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { keeFoxInst._KFLog.debug("Setup has already been done but we will make sure that the window that this scope is a part of has been set up to properly reflect KeeFox status"); keeFoxInst._refreshKPDB(); return; }
startupKeeFox : function(currentKFToolbar, currentWindow) { //keeFoxInst._KFLog = keefox_org.Logger; keefox_org.Logger.info("Testing to see if we've already established whether KeePassRPC is connected."); if (keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { keeFoxInst._KFLog.debug("Setup has already been done but we will make sure that the window that this scope is a part of has been set up to properly reflect KeeFox status"); keeFoxInst._refreshKPDB(); //currentKFToolbar.setupButton_ready(currentWindow); //currentKFToolbar.setAllLogins(); //currentWindow.addEventListener("TabSelect", keeFoxInst._onTabSelected, false); //TODO: Move tab selected out here rather than in the module! return; } }
}
startupKeeFox : function(currentKFToolbar, currentWindow) { //keeFoxInst._KFLog = keefox_org.Logger; keefox_org.Logger.info("Testing to see if we've already established whether KeePassRPC is connected."); if (keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { keeFoxInst._KFLog.debug("Setup has already been done but we will make sure that the window that this scope is a part of has been set up to properly reflect KeeFox status"); keeFoxInst._refreshKPDB(); //currentKFToolbar.setupButton_ready(currentWindow); //currentKFToolbar.setAllLogins(); //currentWindow.addEventListener("TabSelect", keeFoxInst._onTabSelected, false); //TODO: Move tab selected out here rather than in the module! return; } }
this.maMarkers = new Array();
this.maMarkers = [];
function StationGroup(pIcon, pTitle, pDescription, pWfsUrl, pWfsFeatureType) { // Initialize the members of the class var reg = /\s+/g; this.msId = pTitle.replace(reg, '_'); this.msTitle = pTitle; this.msDescription = pDescription; this.msIcon = pIcon; this.mbIsGroupOn = false; this.msFeatureType = pWfsFeatureType; this.maMarkers = new Array(); this.msWfsUrl = pWfsUrl; this.msLayerName = pWfsFeatureType; this.getMarkers(); // Create Html objects for the station // Create updateCSWRecords new station control element this.moHtmlBundle = document.createElement("div"); this.moHtmlBundle.id = this.msId + "_div"; this.moHtmlBundle.style.background = "#F7EFC1"; this.moHtmlBundle.style.top = "5 px"; // Create the img element for each group this.moHtmlImg = document.createElement("img"); this.moHtmlImg.id = this.msId; this.moHtmlImg.src = this.msIcon; this.moHtmlImg.onmouseover = this.getShowToolTipFn(); this.moHtmlImg.onmouseout = this.getHideToolTipFn(); // Create the checkbox element for each image this.moHtmlChk = document.createElement("input"); this.moHtmlChk.type = "checkbox"; this.moHtmlChk.id = this.msId + "_chk"; this.moHtmlChk.checked = 0; this.moHtmlChk.onclick = this.getClickFn(); // Create the lbl element for each image this.moHtmlLbl = document.createElement("label"); //this.moHtmlLbl.for = this.msId; this.moHtmlLbl.id = this.msId + "_lbl"; this.moHtmlLbl.className = "textoff"; this.moHtmlLbl.align = "left"; this.moHtmlLbl.innerHTML = "<br/>" + this.msTitle + "<br/><br/>"; // Add to the station control frame this.moHtmlBundle.appendChild(this.moHtmlImg); this.moHtmlBundle.appendChild(this.moHtmlChk); this.moHtmlBundle.appendChild(this.moHtmlLbl); }
}
};
function StationGroup_getClickFn() { var group = this; return function() { group.onClick(); }}
}
};
function StationGroup_getHideToolTipFn() { return function() { UnTip(); }}
}
};
function StationGroup_getShowToolTipFn() { var group = this; return function() { Tip(group.msDescription); }}
if (g_IsIE)
if (g_IsIE) {
function StationGroup_parseXmlForMarkers(pRootNode) { var rootNode = pRootNode; if (g_IsIE) rootNode.setProperty("SelectionLanguage", "XPath"); // Parse the XML for stations // Beware of using namespaces when using getElementsByTagName - it does not include namespaces in parsing. var aStations = rootNode.getElementsByTagName(this.msFeatureType); if (!aStations.length) { // Try to find elements without specifying their namespaces. aStations = rootNode.getElementsByTagName(this.msFeatureType.replace(/^[^:]+:/, "")); } if (!aStations.length) return; // Depending on the featureType, create markers for the stations. switch(this.msFeatureType) { case "gsml:Borehole" : for (var i = 0; i < aStations.length; i++) { var boreholeMarker = new NVCLMarker(aStations[i], this.msIcon); if (boreholeMarker) { this.maMarkers[i] = boreholeMarker; } } break; case "geodesy:stations" : for (var i = 0; i < aStations.length; i++) { var geodesyMarker = new GeodesyMarker(aStations[i], this.msIcon, this.msWfsUrl, "geodesy:station_observations"); if (geodesyMarker) { this.maMarkers[i] = geodesyMarker; } } break; case "sa:SamplingPoint" : for (var i = 0; i < aStations.length; i++) { var gnssMarker = new GNSSMarker(aStations[i], this.msIcon); if (gnssMarker) { this.maMarkers[i] = gnssMarker; } } break; case "Avhrr48to72Hours-1404" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; case "Modis48to72Hours-1604" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; }}
if (!aStations.length)
if (!aStations.length) {
function StationGroup_parseXmlForMarkers(pRootNode) { var rootNode = pRootNode; if (g_IsIE) rootNode.setProperty("SelectionLanguage", "XPath"); // Parse the XML for stations // Beware of using namespaces when using getElementsByTagName - it does not include namespaces in parsing. var aStations = rootNode.getElementsByTagName(this.msFeatureType); if (!aStations.length) { // Try to find elements without specifying their namespaces. aStations = rootNode.getElementsByTagName(this.msFeatureType.replace(/^[^:]+:/, "")); } if (!aStations.length) return; // Depending on the featureType, create markers for the stations. switch(this.msFeatureType) { case "gsml:Borehole" : for (var i = 0; i < aStations.length; i++) { var boreholeMarker = new NVCLMarker(aStations[i], this.msIcon); if (boreholeMarker) { this.maMarkers[i] = boreholeMarker; } } break; case "geodesy:stations" : for (var i = 0; i < aStations.length; i++) { var geodesyMarker = new GeodesyMarker(aStations[i], this.msIcon, this.msWfsUrl, "geodesy:station_observations"); if (geodesyMarker) { this.maMarkers[i] = geodesyMarker; } } break; case "sa:SamplingPoint" : for (var i = 0; i < aStations.length; i++) { var gnssMarker = new GNSSMarker(aStations[i], this.msIcon); if (gnssMarker) { this.maMarkers[i] = gnssMarker; } } break; case "Avhrr48to72Hours-1404" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; case "Modis48to72Hours-1604" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; }}
}
function StationGroup_parseXmlForMarkers(pRootNode) { var rootNode = pRootNode; if (g_IsIE) rootNode.setProperty("SelectionLanguage", "XPath"); // Parse the XML for stations // Beware of using namespaces when using getElementsByTagName - it does not include namespaces in parsing. var aStations = rootNode.getElementsByTagName(this.msFeatureType); if (!aStations.length) { // Try to find elements without specifying their namespaces. aStations = rootNode.getElementsByTagName(this.msFeatureType.replace(/^[^:]+:/, "")); } if (!aStations.length) return; // Depending on the featureType, create markers for the stations. switch(this.msFeatureType) { case "gsml:Borehole" : for (var i = 0; i < aStations.length; i++) { var boreholeMarker = new NVCLMarker(aStations[i], this.msIcon); if (boreholeMarker) { this.maMarkers[i] = boreholeMarker; } } break; case "geodesy:stations" : for (var i = 0; i < aStations.length; i++) { var geodesyMarker = new GeodesyMarker(aStations[i], this.msIcon, this.msWfsUrl, "geodesy:station_observations"); if (geodesyMarker) { this.maMarkers[i] = geodesyMarker; } } break; case "sa:SamplingPoint" : for (var i = 0; i < aStations.length; i++) { var gnssMarker = new GNSSMarker(aStations[i], this.msIcon); if (gnssMarker) { this.maMarkers[i] = gnssMarker; } } break; case "Avhrr48to72Hours-1404" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; case "Modis48to72Hours-1604" : for (var i = 0; i < aStations.length; i++) { var gaSentinelMarker = new GaSentinelMarker(aStations[i], this.msIcon); if (gaSentinelMarker) { this.maMarkers[i] = gaSentinelMarker; } } break; }}
var boundfunc; if(this.firstRun) { switch($type(func)) { case 'function': boundfunc = func.bind(this); this.currentContext.insertStep({type:'f',data:boundfunc,firstRun:true}); break; case 'array': this.DO(func); break; case 'number': if (func == EXIT) { this.currentContext.insertStep({type:'exit'}); break; } default: this.currentContext.insertStep({type:'fail',data:'Invalid Entry in DO array'}); } } return this;
this.step(func); this.currentContext.step--;
STEP:function(func) { var boundfunc; if(this.firstRun) { switch($type(func)) { case 'function': boundfunc = func.bind(this); this.currentContext.insertStep({type:'f',data:boundfunc,firstRun:true}); break; case 'array': this.DO(func); //recursively add the next level break; case 'number': if (func == EXIT) { this.currentContext.insertStep({type:'exit'}); break; } //deliberately fall through default: this.currentContext.insertStep({type:'fail',data:'Invalid Entry in DO array'}); } } return this; },
this.currentContext.insertStep({type:'fail',data:'Invalid Entry in DO array'});
this.currentContext.insertStep({type:'exit'});
step:function (func) { var boundfunc; switch($type(func)) { case 'function': boundfunc = func.bind(this); this.currentContext.insertStep({type:'f',data:boundfunc,firstRun:true}); break; case 'array': this.donest(func); //recursively add the next level break; case 'number': if (func == EXIT) { this.currentContext.insertStep({type:'exit'}); break; } //deliberately fall through default: this.currentContext.insertStep({type:'fail',data:'Invalid Entry in DO array'}); } return this; },
self.setValue(value + conf.step * (am || 1), e);
var step = conf.step == 'any' ? 1 : conf.step; self.setValue(value + step * (am || 1), e);
step: function(am, e) { e = e || $.Event(); self.setValue(value + conf.step * (am || 1), e); },
},
}
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function() { SET(NULL_CHECKER); BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result == null || result == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result ); } if ( result ) return DONE(); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
result.prime = NULL_CHECKER;
result.checker = NULL_CHECKER;
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.prime = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.prime == null || result.prime == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.prime ) return DONE( result); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
if ( result.prime == null || result.prime == NULL_CHECKER ) {
if ( result.checker == null || result.checker == NULL_CHECKER ) {
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.prime = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.prime == null || result.prime == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.prime ) return DONE( result); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
if ( result.prime ) return DONE( result);
if ( result.checker ) return DONE();
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.prime = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.prime == null || result.prime == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.prime ) return DONE( result); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
function(result) { result.checker = NULL_CHECKER;
function() { SET(NULL_CHECKER);
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.checker = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.checker == null || result.checker == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.checker ) return DONE(); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
if ( result.checker == null || result.checker == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime );
if ( result == null || result == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result );
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.checker = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.checker == null || result.checker == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.checker ) return DONE(); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
if ( result.checker ) return DONE();
if ( result ) return DONE();
BigInteger.prototype.stepping_fromNumber1 = function( bitLength, certainty, rnd ) { var self=this; BigInteger.log("stepping_fromNumber1"); var NULL_CHECKER = { toString : function() { return "*** FAILED TO RETRIEVE RESULT ***"; } }; // ver2 return STEP(function() { BigInteger.log( "stepping_fromNumber1.1" ); // new BigInteger(int,int,RNG) if( bitLength < 2 ) { self.fromInt( 1 ); return ; } else { self.fromNumber2( bitLength, rnd ); if( ! self.testBit( bitLength-1 ) ) // force MSB set self.bitwiseTo( BigInteger.ONE.shiftLeft( bitLength - 1 ), BigInteger.op_or, self ); if( self.isEven() ) self.dAddOffset( 1,0 ); // force odd BigInteger.log( "stepping_fromNumber1.2" ); return DO([ // ver2 >> function(result) { result.checker = NULL_CHECKER; BigInteger.log( "stepping_fromNumber1.2.1.1: calling stepping_isProbablePrime" ); return self.stepping_isProbablePrime( certainty ); }, function(result) { BigInteger.log( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime:" + result ); if ( result.checker == null || result.checker == NULL_CHECKER ) { BigInteger.err( "stepping_fromNumber1.2.1.2: returned stepping_isProbablePrime: subparam.result == WARNING NULL " + result.prime ); } if ( result.checker ) return DONE(); }, // ver2 << function() { BigInteger.log("stepping_fromNumber1.2.2"); self.dAddOffset( 2, 0 ); if( self.bitLength() > bitLength ) { self.subTo( BigInteger.ONE.shiftLeft(bitLength-1), self ); } }, ]); } }); }
RSA.log( "RSAEngine:2.3.3:subparam.result="+result );
RSA.log( "RSAEngine:2.3.3:result="+result );
function stepping_generate (myArgs) { var B,E; B = myArgs[0]; E = myArgs[1]; //var rng = new SecureRandom(); // MODIFIED 2008/12/07 var rng; // var qs = B>>1; var qs = self.splitBitLength( B ); self._e(E); var ee = new BigInteger(self.e); var p1; var q1; var phi; return DO([ // Step1.ver2 function () { RSA.log("RSAEngine:1.1"); self.p = new BigInteger(); rng = new SecureRandom(); }, function () { RSA.log("RSAEngine:1.2"); // return self.p.stepping_fromNumber1( B-qs, 1, rng ).BREAK(); return self.p.stepping_fromNumber1( qs[0], 1, rng ); }, [ // Step1.3 ver3 function () { RSA.log("RSAEngine:1.3.1"); if ( self.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) != 0 ) return AGAIN(); }, function () { RSA.log("RSAEngine:1.3.2 : calling stepping_isProbablePrime"); return self.p.stepping_isProbablePrime(10); }, function (result) { RSA.log("RSAEngine:1.3.3 : returned stepping_isProbablePrime" + result ); if ( result ) { RSA.log("RSAEngine:1.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:1.3.3=>AGAIN"); return AGAIN(); } }, EXIT ], function() { RSA.log("RSAEngine:2.0"); }, // Step2.ver2 [ function() { RSA.log("RSAEngine:2.1"); self.q = new BigInteger(); }, function () { RSA.log("RSAEngine:2.2"); // return self.q.stepping_fromNumber1( qs, 1, rng ).BREAK(); return self.q.stepping_fromNumber1( qs[1], 1, rng ); }, // Step2.3 ver2>>> function () { RSA.log("RSAEngine:2.3.1"); if ( self.q.subtract( BigInteger.ONE ).gcd( ee ).compareTo( BigInteger.ONE ) != 0 ) return AGAIN(); }, function() { RSA.log("RSAEngine:2.3.2"); return self.q.stepping_isProbablePrime(10); }, function(result) { RSA.log( "RSAEngine:2.3.3:subparam.result="+result ); if ( result ) { RSA.log("RSAEngine:2.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:2.3.3=>AGAIN"); return AGAIN(); } }, // <<< EXIT ], function() { RSA.log("RSAEngine:2.3"); if ( self.p.compareTo(self.q) <= 0 ) { var t = self.p; self.p = self.q; self.q = t; } RSA.log("RSAEngine:3.1"); RSA.log( "p=" + self.p.toString(16) ); RSA.log( "q=" + self.q.toString(16) ); }, // // Step3.2 ver2 >>> function() { RSA.log("RSAEngine:3.2"); /* var */ p1 = self.p.subtract( BigInteger.ONE ); /* var */ q1 = self.q.subtract( BigInteger.ONE ); /* var */ phi = p1.multiply( q1 ); if ( phi.gcd(ee).compareTo( BigInteger.ONE ) == 0 ) { RSA.log("RSAEngine:3.2=>BREAK"); return ; } else { RSA.log("RSAEngine:3.2=>AGAIN"); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.2.sub"); // ADDED 11Dec,2008 Ats >>> // When p and q in a RSA key have the same value, the RSA // key cannot encrypt/decrypt messages correctly. // Check if they have the same value and if so regenerate these value again. // Though rarely do p and q conflict when key length is large enough. // <<< if ( self.p.compareTo( self.q ) ==0 ) { RSA.log("RSAEngine:3.2.sub +++ P & Q ARE EQUAL !!!"); return AGAIN(); } self.n = self.p.multiply( self.q ); // ADDED 2008/12/1 >>> // if ( self.n.bitLength() != B ) { // if ( self.n.bitLength() < B ) { // modified 2009/1/13 if ( ! self.isProperBitLength( self.n, B ) ) { // modified 2009/1/15 RSA.log("RSAEngine:3.3.2.1:AGAIN bitLength="+self.n.bitLength() + " B=" + B ); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.3.1"); RSA.log("RSAEngine:3.3.1(1)"); self.d = ee.modInverse( phi ); RSA.log("RSAEngine:3.3.2(2)"); self._ksize(B); // added Jan15,2009 }, function() { RSA.log("RSAEngine:3.3.2"); self.dmp1 = self.d.mod(p1); self.dmq1 = self.d.mod(q1); }, function() { RSA.log("RSAEngine:3.3.3"); self.coeff = self.q.modInverse(self.p); }, // <<< EXIT ]); }
if ( result.prime ) {
if ( result ) {
function stepping_generate (myArgs) { var B,E; B = myArgs[0]; E = myArgs[1]; //var rng = new SecureRandom(); // MODIFIED 2008/12/07 var rng; // var qs = B>>1; var qs = self.splitBitLength( B ); self._e(E); var ee = new BigInteger(self.e); var p1; var q1; var phi; return DO([ // Step1.ver2 function () { RSA.log("RSAEngine:1.1"); self.p = new BigInteger(); rng = new SecureRandom(); }, function () { RSA.log("RSAEngine:1.2"); // return self.p.stepping_fromNumber1( B-qs, 1, rng ).BREAK(); return self.p.stepping_fromNumber1( qs[0], 1, rng ); }, [ // Step1.3 ver3 function () { RSA.log("RSAEngine:1.3.1"); if ( self.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) != 0 ) return AGAIN(); }, function () { RSA.log("RSAEngine:1.3.2 : calling stepping_isProbablePrime"); return self.p.stepping_isProbablePrime(10); }, function (result) { RSA.log("RSAEngine:1.3.3 : returned stepping_isProbablePrime" + result ); if ( result.prime ) { RSA.log("RSAEngine:1.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:1.3.3=>AGAIN"); return AGAIN(); } }, EXIT ], function() { RSA.log("RSAEngine:2.0"); }, // Step2.ver2 [ function() { RSA.log("RSAEngine:2.1"); self.q = new BigInteger(); }, function () { RSA.log("RSAEngine:2.2"); // return self.q.stepping_fromNumber1( qs, 1, rng ).BREAK(); return self.q.stepping_fromNumber1( qs[1], 1, rng ); }, // Step2.3 ver2>>> function () { var result = self.q.subtract( BigInteger.ONE ).gcd( ee ).compareTo( BigInteger.ONE ); RSA.log("RSAEngine:2.3.1 returned from q.stepping_from number with result "+result); if ( result != 0 ) return AGAIN(); }, function() { RSA.log("RSAEngine:2.3.2"); return self.q.stepping_isProbablePrime(10); }, function(result) { RSA.log( "RSAEngine:2.3.3:result="+result.prime ); if ( result.prime ) { RSA.log("RSAEngine:2.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:2.3.3=>AGAIN"); return AGAIN(); } }, // <<< EXIT ], function() { RSA.log("RSAEngine:2.3"); if ( self.p.compareTo(self.q) <= 0 ) { var t = self.p; self.p = self.q; self.q = t; } RSA.log("RSAEngine:3.1"); RSA.log( "p=" + self.p.toString(16) ); RSA.log( "q=" + self.q.toString(16) ); }, // // Step3.2 ver2 >>> function() { RSA.log("RSAEngine:3.2"); /* var */ p1 = self.p.subtract( BigInteger.ONE ); /* var */ q1 = self.q.subtract( BigInteger.ONE ); /* var */ phi = p1.multiply( q1 ); if ( phi.gcd(ee).compareTo( BigInteger.ONE ) == 0 ) { RSA.log("RSAEngine:3.2=>BREAK"); return ; } else { RSA.log("RSAEngine:3.2=>AGAIN"); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.2.sub"); // ADDED 11Dec,2008 Ats >>> // When p and q in a RSA key have the same value, the RSA // key cannot encrypt/decrypt messages correctly. // Check if they have the same value and if so regenerate these value again. // Though rarely do p and q conflict when key length is large enough. // <<< if ( self.p.compareTo( self.q ) ==0 ) { RSA.log("RSAEngine:3.2.sub +++ P & Q ARE EQUAL !!!"); return AGAIN(); } self.n = self.p.multiply( self.q ); // ADDED 2008/12/1 >>> // if ( self.n.bitLength() != B ) { // if ( self.n.bitLength() < B ) { // modified 2009/1/13 if ( ! self.isProperBitLength( self.n, B ) ) { // modified 2009/1/15 RSA.log("RSAEngine:3.3.2.1:AGAIN bitLength="+self.n.bitLength() + " B=" + B ); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.3.1"); RSA.log("RSAEngine:3.3.1(1)"); self.d = ee.modInverse( phi ); RSA.log("RSAEngine:3.3.2(2)"); self._ksize(B); // added Jan15,2009 }, function() { RSA.log("RSAEngine:3.3.2"); self.dmp1 = self.d.mod(p1); self.dmq1 = self.d.mod(q1); }, function() { RSA.log("RSAEngine:3.3.3"); self.coeff = self.q.modInverse(self.p); }, // <<< EXIT ]); }
RSA.log( "RSAEngine:2.3.3:result="+result.prime ); if ( result.prime ) {
RSA.log( "RSAEngine:2.3.3:result="+result ); if ( result ) {
function stepping_generate (myArgs) { var B,E; B = myArgs[0]; E = myArgs[1]; //var rng = new SecureRandom(); // MODIFIED 2008/12/07 var rng; // var qs = B>>1; var qs = self.splitBitLength( B ); self._e(E); var ee = new BigInteger(self.e); var p1; var q1; var phi; return DO([ // Step1.ver2 function () { RSA.log("RSAEngine:1.1"); self.p = new BigInteger(); rng = new SecureRandom(); }, function () { RSA.log("RSAEngine:1.2"); // return self.p.stepping_fromNumber1( B-qs, 1, rng ).BREAK(); return self.p.stepping_fromNumber1( qs[0], 1, rng ); }, [ // Step1.3 ver3 function () { RSA.log("RSAEngine:1.3.1"); if ( self.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) != 0 ) return AGAIN(); }, function () { RSA.log("RSAEngine:1.3.2 : calling stepping_isProbablePrime"); return self.p.stepping_isProbablePrime(10); }, function (result) { RSA.log("RSAEngine:1.3.3 : returned stepping_isProbablePrime" + result ); if ( result.prime ) { RSA.log("RSAEngine:1.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:1.3.3=>AGAIN"); return AGAIN(); } }, EXIT ], function() { RSA.log("RSAEngine:2.0"); }, // Step2.ver2 [ function() { RSA.log("RSAEngine:2.1"); self.q = new BigInteger(); }, function () { RSA.log("RSAEngine:2.2"); // return self.q.stepping_fromNumber1( qs, 1, rng ).BREAK(); return self.q.stepping_fromNumber1( qs[1], 1, rng ); }, // Step2.3 ver2>>> function () { var result = self.q.subtract( BigInteger.ONE ).gcd( ee ).compareTo( BigInteger.ONE ); RSA.log("RSAEngine:2.3.1 returned from q.stepping_from number with result "+result); if ( result != 0 ) return AGAIN(); }, function() { RSA.log("RSAEngine:2.3.2"); return self.q.stepping_isProbablePrime(10); }, function(result) { RSA.log( "RSAEngine:2.3.3:result="+result.prime ); if ( result.prime ) { RSA.log("RSAEngine:2.3.3=>EXIT"); return DONE(); } else { RSA.log("RSAEngine:2.3.3=>AGAIN"); return AGAIN(); } }, // <<< EXIT ], function() { RSA.log("RSAEngine:2.3"); if ( self.p.compareTo(self.q) <= 0 ) { var t = self.p; self.p = self.q; self.q = t; } RSA.log("RSAEngine:3.1"); RSA.log( "p=" + self.p.toString(16) ); RSA.log( "q=" + self.q.toString(16) ); }, // // Step3.2 ver2 >>> function() { RSA.log("RSAEngine:3.2"); /* var */ p1 = self.p.subtract( BigInteger.ONE ); /* var */ q1 = self.q.subtract( BigInteger.ONE ); /* var */ phi = p1.multiply( q1 ); if ( phi.gcd(ee).compareTo( BigInteger.ONE ) == 0 ) { RSA.log("RSAEngine:3.2=>BREAK"); return ; } else { RSA.log("RSAEngine:3.2=>AGAIN"); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.2.sub"); // ADDED 11Dec,2008 Ats >>> // When p and q in a RSA key have the same value, the RSA // key cannot encrypt/decrypt messages correctly. // Check if they have the same value and if so regenerate these value again. // Though rarely do p and q conflict when key length is large enough. // <<< if ( self.p.compareTo( self.q ) ==0 ) { RSA.log("RSAEngine:3.2.sub +++ P & Q ARE EQUAL !!!"); return AGAIN(); } self.n = self.p.multiply( self.q ); // ADDED 2008/12/1 >>> // if ( self.n.bitLength() != B ) { // if ( self.n.bitLength() < B ) { // modified 2009/1/13 if ( ! self.isProperBitLength( self.n, B ) ) { // modified 2009/1/15 RSA.log("RSAEngine:3.3.2.1:AGAIN bitLength="+self.n.bitLength() + " B=" + B ); return AGAIN(); } }, function() { RSA.log("RSAEngine:3.3.1"); RSA.log("RSAEngine:3.3.1(1)"); self.d = ee.modInverse( phi ); RSA.log("RSAEngine:3.3.2(2)"); self._ksize(B); // added Jan15,2009 }, function() { RSA.log("RSAEngine:3.3.2"); self.dmp1 = self.d.mod(p1); self.dmq1 = self.d.mod(q1); }, function() { RSA.log("RSAEngine:3.3.3"); self.coeff = self.q.modInverse(self.p); }, // <<< EXIT ]); }
},
}
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function() { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; return DONE(true); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; return DONE(false); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; return DONE(false); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; return DONE(false); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); SET(null); return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result ); return DONE(); }, ]); };
return DONE(result);
return DONE();
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(result); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(result); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(result); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime return DONE(result); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(result); }, ]); };
result.prime return DONE(result);
result.prime = false; return DONE();
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(result); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(result); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(result); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime return DONE(result); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(result); }, ]); };
function(result) {
function() {
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
result.prime = true; return DONE();
return DONE(true);
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
result.prime = false; return DONE();
return DONE(false);
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
result.prime=null;
SET(null);
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime );
BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result );
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime );
BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result );
BigInteger.prototype.stepping_isProbablePrime = function (t) {// BigInteger.log( "stepping_isProbablePrime:create" ); var self = this; var x = self.abs(); return DO([ function(result) { BigInteger.log("stepping_isProbablePrime No.1: " ); // if ( param.result == null ) { // BigInteger.err("stepping_isProbablePrime No.1: WARNING param.result=null / param="+param ); // } var i; if( x.t == 1 && x[0] <= lowprimes[ lowprimes.length-1 ] ) { for ( i = 0; i < lowprimes.length; ++i ) if ( x[0] == lowprimes[i] ) { BigInteger.log( "stepping_isProbablePrime.1 EXIT" ); //return true; result.prime = true; return DONE(); } BigInteger.log( "stepping_isProbablePrime.2 EXIT" ); // return false; result.prime = false; return DONE(); } if ( x.isEven() ) { BigInteger.log( "stepping_isProbablePrime.3 EXIT" ); // return false; result.prime = false; return DONE(); } i = 1; while ( i < lowprimes.length ) { var m = lowprimes[i]; var j = i+1; while( j < lowprimes.length && m < lplim ) { m *= lowprimes[j++]; } m = x.modInt(m); while( i < j ) { if( m % lowprimes[i++] == 0 ) { BigInteger.log( "stepping_isProbablePrime:4 EXIT" ); // return false; result.prime = false; return DONE(); } } } BigInteger.log( "stepping_isProbablePrime:5 BREAK" ); }, // ver2>> function(result) { BigInteger.log( "stepping_isProbablePrime No.2: calling millerRabin : subparam.result=" + result ); result.prime=null; return x.stepping_millerRabin(t); }, function(result) { BigInteger.log( "stepping_isProbablePrime No.3: returning millerRabin : subparam.result=" + result.prime ); BigInteger.log( "stepping_isProbablePrime No.3: param.result=" + result.prime ); return DONE(); }, ]); };
},
}
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function() {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; return DONE(false); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function() {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); return DONE(true); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function () {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT return DONE(false); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); return DONE(false); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
return DONE(result);
return DONE();
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(result); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(result); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(result); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(result); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function (result ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(result); }, ]); // VER2 << };
function (result ) {
function ( ) {
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(result); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(result); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(result); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(result); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function (result ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(result); }, ]); // VER2 << };
function(result ) {
function() {
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
result.prime = false return DONE();
return DONE(false);
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
result.prime = true return DONE();
return DONE(true);
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
y = result.y;
y = result;
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
result.prime = false; return DONE();
return DONE(false);
BigInteger.prototype.stepping_millerRabin = function ( t ) {// BigInteger.log( "stepping_millerRabin" ); var self=this; // VER2>> // LOOP1 var n1; var k; var r; var a; // LOOP2 var i=0; var y; return DO([ function(result ) {// BigInteger.log( "stepping_millerRabin:No1" ); n1 = self.subtract( BigInteger.ONE ); k = n1.getLowestSetBit(); if ( k <= 0) { // return false; result.prime = false return DONE(); } r = n1.shiftRight(k); t = (t+1) >> 1; if ( t > lowprimes.length ) t = lowprimes.length; a = new BigInteger(); }, // ver3 // function( scope, param, subparam ) { // for ( var i = 0; i < t; ++i ) { [ function(result) {// BigInteger.log( "stepping_millerRabin:No2.1" ); if ( i < t ) {// BigInteger.log( "stepping_millerRabin:No2.1.1" ); return; } else {// BigInteger.log( "stepping_millerRabin:No2.1.2" ); result.prime = true return DONE(); } }, function() { BigInteger.log( "stepping_millerRabin:No2.2" ); a.fromInt( lowprimes[i] ); }, // // ver1>> // function() { // /*var*/ y = a.modPow( r,self ); // return BREAK; // }, // // ver1<< // ver2>>> function() {// BigInteger.log( "stepping_millerRabin:No2.3 : calling stepping_modPow()") return a.stepping_modPow(r,self); }, function(result) { y = result.y;// BigInteger.log( "stepping_millerRabin:No2.4 : returned from stepping_modPow() result=" + y) }, // ver2<<< function (result) {// BigInteger.log( "stepping_millerRabin:No2.5 " ); if( y.compareTo( BigInteger.ONE ) != 0 && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.1 " ); var j = 1; while ( j++ < k && y.compareTo( n1 ) != 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.2 j=" + j ); y = y.modPowInt( 2, self ); if ( y.compareTo( BigInteger.ONE ) == 0 ) {// BigInteger.log( "stepping_millerRabin:No2.5.3 " ); // return false; // return BREAK; // return EXIT; result.prime = false; return DONE(); } } if ( y.compareTo( n1 ) != 0 ) { // return false; // return BREAK; // return EXIT;// BigInteger.log( "stepping_millerRabin:No2.5.4 " + result ); result.prime = false; return DONE(); }// BigInteger.log( "stepping_millerRabin:No2.5.5 " ); }// BigInteger.log( "stepping_millerRabin:No2.5.2 " ); }, function () {// BigInteger.log( "stepping_millerRabin:No2.6" ); ++i; }, ], // } // return BREAK; // return LABEL("LOOP1").BREAK(); //}, //ver3 function ( ) { // return true;// BigInteger.log( "stepping_millerRabin:No3 : param.result=" + true ); return DONE(); }, ]); // VER2 << };
},
}
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function() {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; return DONE(r); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function() { // return z.revert(r); var result = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(result); }, ]); };
return DONE(result);
return DONE();
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function(result) {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; result.y = r return DONE(result); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function(result) { // return z.revert(r); result.y = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(result); }, ]); };
function(result) {
function() {
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function(result) {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; result.y = r return DONE(); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function(result) { // return z.revert(r); result.y = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(); }, ]); };
result.y = r return DONE();
return DONE(r);
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function(result) {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; result.y = r return DONE(); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function(result) { // return z.revert(r); result.y = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(); }, ]); };
result.y = z.revert(r);
var result = z.revert(r);
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function(result) {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; result.y = r return DONE(); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function(result) { // return z.revert(r); result.y = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(); }, ]); };
return DONE();
return DONE(result);
BigInteger.prototype.stepping_modPow = function (e,m) { var self=this; var i,k,r,z; var g; var j,w,is1,r2,t; return DO([ function(result) {// BigInteger.log("stepping_modPow 1:" ); // var i = e.bitLength(), k, r = new BigInteger(1), z; i = e.bitLength(); r = new BigInteger(1); if ( i <= 0 ){ // return r; result.y = r return DONE(); } else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) { // BigInteger.log( "modPow.Classic" ); z = new BigInteger.Classic(m); } else if(m.isEven()) { // BigInteger.log( "modPow.Barrett" ); z = new BigInteger.Barrett(m); } else { // BigInteger.log( "modPow.Montgomery" ); z = new BigInteger.Montgomery(m); } // precomputation /*var*/ g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1; g[1] = z.convert(self); if ( k > 1 ) { var g2 = new BigInteger(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = new BigInteger(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } // /*var*/ j = e.t-1, w, is1 = true, r2 = new BigInteger(), t; j = e.t-1; is1 = true; r2 = new BigInteger(); i = BigInteger.nbits(e[j])-1; // }, function( ) {// BigInteger.log("stepping_modPow 2: j="+j ); // while(j >= 0) { if ( j >= 0 ) { if ( i >= k1) { w = ( e[j] >> ( i - k1 ) ) & km; } else { w = ( e[j] & ( ( 1 << (i + 1 ) ) - 1 ) ) << ( k1 -i ); if ( j > 0 ) w |= e[j-1] >> ( BigInteger.DB + i - k1 ); } n = k; while((w&1) == 0) { w >>= 1; --n; } if ( (i -= n) < 0) { i += BigInteger.DB; --j; } if( is1 ) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0){ z.sqrTo(r,r2); } else { t = r; r = r2; r2 = t; } z.mulTo( r2, g[w], r ); } while ( j >= 0 && ( e[j] & ( 1 << i ) ) == 0 ) { z.sqrTo(r,r2); t = r; r = r2; r2 = t; if(--i < 0) { i = BigInteger.DB-1; --j; } } return CONTINUE(); } else { return ; } }, function(result) { // return z.revert(r); result.y = z.revert(r);// BigInteger.log("stepping_modPow 3:result=" + result ); //return BREAK; return DONE(); }, ]); };
},
}
stop: function() { self.pause(); stopped = true; },
fullPoll=false;
fullPoll=1;
stop : function() { fullPoll=false; },
playEmbedded.stop();
function stopPlay(){ playEmbedded.stop();}
}
};
I18n.strftime = function(date, format) { var options = this.lookup("date"); if (!options) { return date.toString(); } var weekDay = date.getDay(); var day = date.getDate(); var year = date.getFullYear(); var month = date.getMonth() + 1; var hour = date.getHours(); var hour12 = hour; var meridian = hour > 12? "PM" : "AM"; var secs = date.getSeconds(); var mins = date.getMinutes(); var offset = date.getTimezoneOffset(); var absOffsetHours = Math.floor(Math.abs(offset / 60)); var absOffsetMinutes = Math.abs(offset) - (absOffsetHours * 60); var timezoneoffset = (offset > 0 ? "-" : "+") + (absOffsetHours.toString().length < 2 ? "0" + absOffsetHours : absOffsetHours) + (absOffsetMinutes.toString().length < 2 ? "0" + absOffsetMinutes : absOffsetMinutes); if (hour12 > 12) { hour12 = hour12 - 12; } var padding = function(n) { var s = "0" + n.toString(); return s.substr(s.length - 2); } var f = format; f = f.replace("%a", options["abbr_day_names"][weekDay]); f = f.replace("%A", options["day_names"][weekDay]); f = f.replace("%b", options["abbr_month_names"][month]); f = f.replace("%B", options["month_names"][month]); f = f.replace("%d", padding(day)); f = f.replace("%-d", day); f = f.replace("%H", padding(hour)); f = f.replace("%-H", hour); f = f.replace("%I", padding(hour12)); f = f.replace("%-I", hour12); f = f.replace("%m", padding(month)); f = f.replace("%-m", month); f = f.replace("%M", padding(mins)); f = f.replace("%-M", mins); f = f.replace("%p", meridian); f = f.replace("%S", padding(secs)); f = f.replace("%-S", secs); f = f.replace("%w", weekDay); f = f.replace("%y", padding(year)); f = f.replace("%-y", padding(year).replace(/^0+/, "")); f = f.replace("%Y", year); f = f.replace("%z", timezoneoffset); return f;};
R in P&&delete P[Q[S]];}}return O;},embed:function(O){var P=O.parent;if(P&&P.name=='object'){var Q=P.attributes.width,R=P.attributes.height;Q&&(O.attributes.width=Q);R&&(O.attributes.height=R);}},param:function(O){O.children=[];O.isEmpty=true;return O;},a:function(O){if(!(O.children.length||O.attributes.name||O.attributes._cke_saved_name))return false;},body:function(O){delete O.attributes.spellcheck;delete O.attributes.contenteditable;},style:function(O){var P=O.children[0];P&&P.value&&(P.value=e.trim(P.value));if(!O.attributes.type)O.attributes.type='text/css';},title:function(O){O.children[0].value=O.attributes._cke_title;}},attributes:{'class':function(O,P){return e.ltrim(O.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(O){if(O.substr(0,m.length)==m){if(O.substr(m.length,3)=='{C}')O=O.substr(m.length+3);else O=O.substr(m.length);return new a.htmlParser.cdata(decodeURIComponent(O));}return O;}},y={elements:{}};for(u in t)y.elements[u]=r;if(c)x.attributes.style=function(O,P){return O.toLowerCase();};var z=/<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi,A=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,B=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,C=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,D=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,E=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function F(O){return O.replace(z,'$& _cke_saved_$1');};function G(O){return O.replace(A,function(P){return '<cke:encoded>'+encodeURIComponent(P)+'</cke:encoded>';});};function H(O){return O.replace(B,function(P,Q){return decodeURIComponent(Q);});};function I(O){return O.replace(C,'$1cke:$2');};function J(O){return O.replace(D,'$1$2');};function K(O){return O.replace(E,'<cke:$1$2></cke:$1>');};function L(O){return O.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(P){return '<!--'+m+'{C}'+encodeURIComponent(P).replace(/--/g,'%2D%2D')+'-->';});};function M(O){return O.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(P,Q){return decodeURIComponent(Q);});};function N(O,P){var Q=[],R=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,S=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(P);O=O.replace(/<!--[\s\S]*?-->/g,function(U){return '<!--{cke_tempcomment}'+(Q.push(U)-1)+'-->';});for(var T=0;T<S.length;T++)O=O.replace(S[T],function(U){U=U.replace(R,function(V,W,X){return Q[X];});return '<!--{cke_temp}'+(Q.push(U)-1)+'-->';});O=O.replace(R,function(U,V,W){return '<!--'+m+(V?'{C}':'')+encodeURIComponent(Q[W]).replace(/--/g,'%2D%2D')+'-->';
return l.length?l.join(';')+';':false;};},elementMigrateFilter:function(h,i){return function(j){var k=i?new CKEDITOR.style(h,i)._.definition:h;j.name=k.element;CKEDITOR.tools.extend(j.attributes,CKEDITOR.tools.clone(k.attributes));j.addStyle(CKEDITOR.style.getStyleText(k));};},styleMigrateFilter:function(h,i){var j=this.elementMigrateFilter;return function(k,l){var m=new CKEDITOR.htmlParser.element(null),n={};n[i]=k;j(h,n)(m);m.children=l.children;l.children=[m];};},bogusAttrFilter:function(h,i){if(i.name.indexOf('cke:')==-1)return false;},applyStyleFilter:null},getRules:function(h){var i=CKEDITOR.dtd,j=CKEDITOR.tools.extend({},i.$block,i.$listItem,i.$tableContent),k=h.config,l=this.filters,m=l.falsyFilter,n=l.stylesFilter,o=l.elementMigrateFilter,p=CKEDITOR.tools.bind(this.filters.styleMigrateFilter,this.filters),q=l.bogusAttrFilter,r=this.utils.createListBulletMarker,s=l.flattenList,t=l.assembleList,u=this.utils.isListBulletIndicator,v=this.utils.isContainingOnlySpaces,w=this.utils.resolveList,x=this.utils.convertToPx,y=this.utils.getStyleComponents,z=this.utils.listDtdParents,A=k.pasteFromWordRemoveFontStyles!==false,B=k.pasteFromWordRemoveStyles!==false;return{elementNames:[[/meta|link|script/,'']],root:function(C){C.filterChildren();t(C);},elements:{'^':function(C){var D;if(CKEDITOR.env.gecko&&(D=l.applyStyleFilter))D(C);},$:function(C){var D=C.name||'',E=C.attributes;if(D in j&&E.style)E.style=n([[/^(:?width|height)$/,null,x]])(E.style)||'';if(D.match(/h\d/)){C.filterChildren();if(w(C))return;o(k['format_'+D])(C);}else if(D in i.$inline){C.filterChildren();if(v(C))delete C.name;}else if(D.indexOf(':')!=-1&&D.indexOf('cke')==-1){C.filterChildren();if(D=='v:imagedata'){var F=C.attributes['o:href'];if(F)C.attributes.src=F;C.name='img';return;}delete C.name;}if(D in z){C.filterChildren();t(C);}},style:function(C){if(CKEDITOR.env.gecko){var D=C.onlyChild().value.match(/\/\* Style Definitions \*\/([\s\S]*?)\/\*/),E=D&&D[1],F={};if(E){E.replace(/[\n\r]/g,'').replace(/(.+?)\{(.+?)\}/g,function(G,H,I){H=H.split(',');var J=H.length,K;for(var L=0;L<J;L++)CKEDITOR.tools.trim(H[L]).replace(/^(\w+)(\.[\w-]+)?$/g,function(M,N,O){N=N||'*';O=O.substring(1,O.length);if(O.match(/MsoNormal/))return;if(!F[N])F[N]={};if(O)F[N][O]=I;else F[N]=I;});});l.applyStyleFilter=function(G){var H=F['*']?'*':G.name,I=G.attributes&&G.attributes['class'],J;if(H in F){J=F[H];if(typeof J=='object')J=J[I];J&&G.addStyle(J,true);}};}}return false;},p:function(C){C.filterChildren();var D=C.attributes,E=C.parent,F=C.children;
R in P&&delete P[Q[S]];}}return O;},embed:function(O){var P=O.parent;if(P&&P.name=='object'){var Q=P.attributes.width,R=P.attributes.height;Q&&(O.attributes.width=Q);R&&(O.attributes.height=R);}},param:function(O){O.children=[];O.isEmpty=true;return O;},a:function(O){if(!(O.children.length||O.attributes.name||O.attributes._cke_saved_name))return false;},body:function(O){delete O.attributes.spellcheck;delete O.attributes.contenteditable;},style:function(O){var P=O.children[0];P&&P.value&&(P.value=e.trim(P.value));if(!O.attributes.type)O.attributes.type='text/css';},title:function(O){O.children[0].value=O.attributes._cke_title;}},attributes:{'class':function(O,P){return e.ltrim(O.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(O){if(O.substr(0,m.length)==m){if(O.substr(m.length,3)=='{C}')O=O.substr(m.length+3);else O=O.substr(m.length);return new a.htmlParser.cdata(decodeURIComponent(O));}return O;}},y={elements:{}};for(u in t)y.elements[u]=r;if(c)x.attributes.style=function(O,P){return O.toLowerCase();};var z=/<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi,A=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,B=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,C=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,D=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,E=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function F(O){return O.replace(z,'$& _cke_saved_$1');};function G(O){return O.replace(A,function(P){return '<cke:encoded>'+encodeURIComponent(P)+'</cke:encoded>';});};function H(O){return O.replace(B,function(P,Q){return decodeURIComponent(Q);});};function I(O){return O.replace(C,'$1cke:$2');};function J(O){return O.replace(D,'$1$2');};function K(O){return O.replace(E,'<cke:$1$2></cke:$1>');};function L(O){return O.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(P){return '<!--'+m+'{C}'+encodeURIComponent(P).replace(/--/g,'%2D%2D')+'-->';});};function M(O){return O.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(P,Q){return decodeURIComponent(Q);});};function N(O,P){var Q=[],R=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,S=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(P);O=O.replace(/<!--[\s\S]*?-->/g,function(U){return '<!--{cke_tempcomment}'+(Q.push(U)-1)+'-->';});for(var T=0;T<S.length;T++)O=O.replace(S[T],function(U){U=U.replace(R,function(V,W,X){return Q[X];});return '<!--{cke_temp}'+(Q.push(U)-1)+'-->';});O=O.replace(R,function(U,V,W){return '<!--'+m+(V?'{C}':'')+encodeURIComponent(Q[W]).replace(/--/g,'%2D%2D')+'-->';
d.fn.css=function(a,b){return S(this,a,b,true,function(e,g,h){if(h===v)return d.curCSS(e,g);if(typeof h==="number"&&!Oa.test(g))h+="px";d.style(e,g,h)})};d.extend({style:function(a,b,e){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(e)<0)e=v;var g=a.style||a,h=e!==v;if(!d.support.opacity&&b==="opacity"){if(h){g.zoom=1;b=parseInt(e,10)+""==="NaN"?"":"alpha(opacity="+e*100+")";a=g.filter||d.curCSS(a,"filter")||"";g.filter=ma.test(a)?a.replace(ma,b):b}return g.filter&& g.filter.indexOf("opacity=")>=0?parseFloat(na.exec(g.filter)[1])/100+"":""}if(X.test(b))b=pa;b=b.replace(oa,qa);if(h)g[b]=e;return g[b]},css:function(a,b,e,g){if(b==="width"||b==="height"){var h,k=b==="width"?Ta:Ua;function l(){h=b==="width"?a.offsetWidth:a.offsetHeight;g!=="border"&&d.each(k,function(){g||(h-=parseFloat(d.curCSS(a,"padding"+this,true))||0);if(g==="margin")h+=parseFloat(d.curCSS(a,"margin"+this,true))||0;else h-=parseFloat(d.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==
"Bottom"],Va=r.defaultView&&r.defaultView.getComputedStyle,pa=c.support.cssFloat?"cssFloat":"styleFloat",qa=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return S(this,a,b,true,function(e,f,h){if(h===v)return c.curCSS(e,f);if(typeof h==="number"&&!Oa.test(f))h+="px";c.style(e,f,h)})};c.extend({style:function(a,b,e){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(e)<0)e=v;var f=a.style||a,h=e!==v;if(!c.support.opacity&&b==="opacity"){if(h){f.zoom= 1;b=parseInt(e,10)+""==="NaN"?"":"alpha(opacity="+e*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=ma.test(a)?a.replace(ma,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(na.exec(f.filter)[1])/100+"":""}if(X.test(b))b=pa;b=b.replace(oa,qa);if(h)f[b]=e;return f[b]},css:function(a,b,e,f){if(b==="width"||b==="height"){var h,k=b==="width"?Ta:Ua;function l(){h=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(k,function(){f||(h-=parseFloat(c.curCSS(a,"padding"+this,
d.fn.css=function(a,b){return S(this,a,b,true,function(e,g,h){if(h===v)return d.curCSS(e,g);if(typeof h==="number"&&!Oa.test(g))h+="px";d.style(e,g,h)})};d.extend({style:function(a,b,e){if(!a||a.nodeType===3||a.nodeType===8)return v;if((b==="width"||b==="height")&&parseFloat(e)<0)e=v;var g=a.style||a,h=e!==v;if(!d.support.opacity&&b==="opacity"){if(h){g.zoom=1;b=parseInt(e,10)+""==="NaN"?"":"alpha(opacity="+e*100+")";a=g.filter||d.curCSS(a,"filter")||"";g.filter=ma.test(a)?a.replace(ma,b):b}return g.filter&&g.filter.indexOf("opacity=")>=0?parseFloat(na.exec(g.filter)[1])/100+"":""}if(X.test(b))b=pa;b=b.replace(oa,qa);if(h)g[b]=e;return g[b]},css:function(a,b,e,g){if(b==="width"||b==="height"){var h,k=b==="width"?Ta:Ua;function l(){h=b==="width"?a.offsetWidth:a.offsetHeight;g!=="border"&&d.each(k,function(){g||(h-=parseFloat(d.curCSS(a,"padding"+this,true))||0);if(g==="margin")h+=parseFloat(d.curCSS(a,"margin"+this,true))||0;else h-=parseFloat(d.curCSS(a,"border"+this+"Width",true))||0})}a.offsetWidth!==
break; } }
KFILM.prototype.submitForm = function (form) { var inputElements = form.getElementsByTagName("input"); var submitElement = null; // Find the first submit button for(var i = 0; i < inputElements.length; i++) if(inputElements[i].type != null && inputElements[i].type == "submit") submitElement = inputElements[i]; // if no submit button found, try to find an image button if(submitElement != null) { for(var i = 0; i < inputElements.length; i++) if(inputElements[i].type != null && inputElements[i].type == "image") submitElement = inputElements[i]; } // If we've found a button to click, use that; if not, just submit the form. if(submitElement != null) submitElement.click(); else form.submit(); };
},
}
submitHandler : function(form, action, receivedData) { receivedData.mapping = this.payload.data.mapping; },
name : this.loadedUserData.name,
submitHandler : function(form, action, receivedData) { var store; if (this.payload.id == 'new_mapping' && this.payload.hostPanel) { store = this.payload.hostPanel.dataStore; } else if (this.payload.store) { store = this.payload.store; } if (store) { var s = ''; var roles = []; var sentRoles = action.output.data.roles; for (var i = 0; i < sentRoles.length; i++) { var roleName = sentRoles[i]; var roleRec = this.roleDataStore.getAt(this.roleDataStore.find('id', roleName)); if (roleRec) { var newRole = { id : roleRec.data.id, name : roleRec.data.name, source : 'default' } roles.push(newRole); roleName = newRole.name; } if (s) { s += ', '; } s += roleName; } var rec = store.getById(action.output.data.userId); if (rec) { rec.beginEdit(); rec.set('roles', roles); rec.set('displayRoles', s); rec.commit(); rec.endEdit(); } else if (this.payload.hostPanel && this.loadedUserData) { var resourceURI = Sonatype.config.host + Sonatype.config.repos.urls.plexusUser + '/' + this.loadedUserData.userId; var rec = new store.reader.recordType({ name : this.loadedUserData.name, email : this.loadedUserData.email, source : this.loadedUserData.source, userId : this.loadedUserData.userId, resourceURI : resourceURI, roles : roles, displayRoles : s }, resourceURI); rec.autoCreateNewRecord = true; store.addSorted(rec); } } },
while ( str.indexOf("\\n") !== -1) { str = str.replace("\\n", "\n"); } return str; };
str = str.replace("\\n", "\n"); } return str; };
var substInChord = function(str) { while ( str.indexOf("\\n") !== -1) { str = str.replace("\\n", "\n"); } return str; };
jsBackend.messages.add('success', "{$msgCategoryAdded}");
jsBackend.messages.add('success', "{$msgAddedCategory|addslashes}".replace('%1$s', name));
success: function(data, textStatus) { if(data.code == 200) { // existing categoyr if(typeof data.data.id != 'undefined') var id = data.data.id; // doesn't exist else { var id = data.data.new_id; $('#categoryId').append('<option selected="selected" value="'+ id +'">'+ name +'</option>'); } // unselect all $('#categoryId option').attr('selected', ''); // set selected $('#categoryId').val(id); // clear $('#newCategoryValue').val(''); $('#newCategoryButton').addClass('disabledButton'); $('#newCategory').slideUp(); // show message jsBackend.messages.add('success', "{$msgCategoryAdded}"); } else { // show message jsBackend.messages.add('error', textStatus); } // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } }
$this.updateStatusMessage(sprintf(_("Last saved at %1$s", ''+new Date())));
$this.updateStatusMessage(sprintf(_("Last saved at %1$s"), ''+new Date()));
success: function () { $this.save_inprogress = false; $this.updateStatusMessage(sprintf(_("Last saved at %1$s", ''+new Date()))); },
w.close(); Sonatype.MessageBox.show({ title : 'Username Recovery', msg : 'Username request completed successfully.' + '<br /><br />' + 'Check your mailbox, the username reminder should arrive in a few minutes.', buttons : Sonatype.MessageBox.OK, icon : Sonatype.MessageBox.INFO, animEl : 'mb3' }); },
if (activeWindow) { activeWindow.getEl().unmask(); } if (Sonatype.repoServer.RepoServer.loginWindow.isVisible()) { Sonatype.view.loginSuccessfulToken = Sonatype.view.afterLoginToken; Sonatype.repoServer.RepoServer.loginWindow.hide(); Sonatype.repoServer.RepoServer.loginForm.getForm().reset(); } var respObj = Ext.decode(response.responseText); Sonatype.utils.loadNexusStatus(respObj.data.clientPermissions.loggedInUserSource); },
success : function(response, options) { w.close(); Sonatype.MessageBox.show({ title : 'Username Recovery', msg : 'Username request completed successfully.' + '<br /><br />' + 'Check your mailbox, the username reminder should arrive in a few minutes.', buttons : Sonatype.MessageBox.OK, icon : Sonatype.MessageBox.INFO, animEl : 'mb3' }); },
alert("Remote server returned an unsupported response.");
success: function(response, options) { if (isGmlDataThere(response.responseText)) { //Parse the response var XmlDoc = GXml.parse(response.responseText); if (g_IsIE) { XmlDoc.setProperty("SelectionLanguage", "XPath"); } var rootNode = XmlDoc.documentElement; if (!rootNode) { return; } var schemaLoc = rootNode.getAttribute("xsi:schemaLocation"); var reqTypeName = schemaLoc.substring(schemaLoc.indexOf("typeName")+9, schemaLoc.indexOf(' ', schemaLoc.indexOf("typeName")+9)); //Browser may have replaced certain characters reqTypeName = reqTypeName.replace("%3A", ":"); //Extract the line Id from the XML var line = rootNode.getElementsByTagName("gt:LINE"); var lineId = ""; if(line != null && line.length > 0) { if(document.all) { //IE lineId = line[0].text; } else { lineId = line[0].textContent; } if(lineId.indexOf("cdp") == 0) { lineId = lineId.substring(3, lineId.length); } new GeotransectsInfoWindow(latlng, map, lineId, this).show(); } else { //alert("Remote server returned an unsupported response."); } } }.createDelegate(record),
if(line == null || line.length <= 0) {
if(line === null || line.length <= 0) {
success: function(response, options) { if (isGmlDataThere(response.responseText)) { //Parse the response var XmlDoc = GXml.parse(response.responseText); if (g_IsIE) { XmlDoc.setProperty("SelectionLanguage", "XPath"); } var rootNode = XmlDoc.documentElement; if (!rootNode) { return; } var schemaLoc = rootNode.getAttribute("xsi:schemaLocation"); var reqTypeName = schemaLoc.substring(schemaLoc.indexOf("typeName")+9, schemaLoc.indexOf(' ', schemaLoc.indexOf("typeName")+9)); //Browser may have replaced certain characters reqTypeName = reqTypeName.replace("%3A", ":"); //Extract the line Id from the XML var line = rootNode.getElementsByTagName("gt:LINE"); if(line == null || line.length <= 0) { //Chrome, Opera may not want the namespace prefix line = rootNode.getElementsByTagName("LINE"); } // Change to enable the SURV_LINE which is the key in the shapefile if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("gt:SURV_LINE"); if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("SURV_LINE"); } } //Get the line var lineId = ""; if(line != null && line.length > 0) { if(document.all) { //IE lineId = line[0].text; } else { lineId = line[0].textContent; } //Remove the prefixes - we dont store them in the DB if(lineId.indexOf("cdp") == 0) { lineId = lineId.substring(3, lineId.length); } var infoWindow = new GeotransectsInfoWindow(latlng, map, lineId, options.cswRecord, options.wmsOnlineResource, url); infoWindow.show(); } else { alert("Remote server returned an unsupported response."); } } },