Changeset 40
- Timestamp:
- 10/27/07 16:09:28 (6 years ago)
- Location:
- trunk/javascript
- Files:
-
- 2 edited
-
klassenbuch.comments.js (modified) (1 diff)
-
klassenbuch.controls.js (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/javascript/klassenbuch.comments.js
r38 r40 513 513 var comment = this.comment.text.replaceAll("[BR /]", "<br />"); 514 514 515 [["B", "strong"], ["I", "em"], ["U", "u"]].each(function(a) { 516 if (comment.count("[" + a[0] + "]") === comment.count("[/" + a[0] + "]")) { 517 comment = comment.replaceAll("[" + a[0] + "]", "<" + a[1] + ">").replaceAll("[/" + a[0] + "]", "</" + a[1] + ">"); 515 [["[B]", "[/B]", "<b>", "</b>"], ["[I]", "[/I]", "<i>", "</i>"], ["[U]", "[/U]", "<u>", "</u>"]].each(function(a) { 516 var count1 = comment.count(a[0]); 517 if (count1 && count1 === comment.count(a[1])) { 518 comment = comment.replaceAll(a[0], a[2]).replaceAll(a[1], a[3]); 518 519 } 519 });520 }); 520 521 521 522 Comments.Emoticons.each(function(pair) { -
trunk/javascript/klassenbuch.controls.js
r38 r40 140 140 }); 141 141 142 $w("setStyle addClassName removeClassName toggleClassName ").each(function(a) {142 $w("setStyle addClassName removeClassName toggleClassName centerOnScreen").each(function(a) { 143 143 Control.prototype[a] = function(val) { 144 144 this.element[a](val); … … 225 225 Controls.Button = Class.create(Control, { 226 226 initialize: function($super, caption, action, options) { 227 if (!Object.isString(caption)) {228 return;229 }230 231 227 // Überschreibt die mit options übergebenen Einstellungen mit den Standardwerten 232 this.setOptions({ enabled: true, 228 this.setOptions({ 229 enabled: true, 233 230 onlySignedIn: false, 234 231 className: "", … … 239 236 }, options); 240 237 241 this.action = action || Prototype.emptyFunction; 242 243 $super(new Element(this.options.tag, { className: "unselectable " + this.options.className })); 238 $super(new Element(this.options.tag, { 239 className: "unselectable " + this.options.className, 240 title: this.options.title 241 })); 244 242 243 this.action = action || Prototype.emptyFunction; 245 244 this.setCaption(caption); 246 245 … … 251 250 this.on("click", action); 252 251 253 ["Over", "Down", "Out", "Up"].each(function(a) {254 this.element.observe( ("mouse" + a).toLowerCase(), this["_on" + a].bind(this));252 $w("over down out up").each(function(a) { 253 this.element.observe("mouse" + a, this._setState.bind(this, a)); 255 254 }, this); 256 255 … … 261 260 262 261 this._updateContent(); 263 264 this._onOut();265 262 this.enable(); 266 263 … … 271 268 if (!this.options.visible) { 272 269 this.hide(); 273 }274 275 if (this.options.title) {276 this.element.writeAttribute("title", this.options.title);277 270 } 278 271 }, … … 339 332 }, 340 333 341 _onOver: function() {342 this._setBackground(-100);343 },344 345 _onDown: function() {346 this._setBackground(-200);347 },348 349 _onOut: function() {350 this._setBackground(0);351 },352 353 _onUp: function() {354 this._setBackground(-100);355 },356 357 334 setButtonClass: function(buttonClass) { 358 335 if (this.buttonClass) { … … 364 341 }, 365 342 366 _setBackground: function(position) { 367 if (this.enabled) { 343 _setState: function(state) { 344 var position = { 345 out: 0, 346 enabled: 0, 347 over: -100, 348 up: -100, 349 down: -200, 350 disabled: -300 351 }[state]; 352 353 if (this.enabled && Object.isDefined(position)) { 368 354 this.leftBoundary.setStyle({ backgroundPosition: "0px " + position + "px" }); 369 355 this.rightBoundary.setStyle({ backgroundPosition: "100% " + position + "px" }); … … 378 364 if (!this.enabled) { 379 365 this.enabled = true; 380 this._ onOut();366 this._setState("enabled"); 381 367 382 368 this.removeClassName("disabled" + this.options.buttonClass.capitalize()); … … 399 385 disable: function() { 400 386 if (this.enabled) { 401 this._set Background(-300);387 this._setState("disabled"); 402 388 this.enabled = false; 403 389 … … 417 403 Controls.Link = Class.create(Control, { 418 404 initialize: function($super, caption, action) { 419 $super(new Element("a", { className: "linkControl", href: "javascript:void(null);" })); 405 $super(new Element("a", { 406 className: "linkControl", 407 href: "javascript:void(null);" 408 })); 420 409 421 410 this.element.innerHTML = caption; 422 411 this.element.observe("click", this.fireEvent.bind(this, "click")); 423 412 424 this.on("click", action );413 this.on("click", action || Prototype.K); 425 414 } 426 415 }); … … 610 599 611 600 tab.on("activate", this._onTabActivated, this); 612 613 if (!this.activeTab) { 614 tab.activate(); 615 } else { 616 tab.deactivate(); 617 } 601 tab[(this.activeTab) ? "deactivate" : "activate"](); 618 602 619 603 this.tabs.splice(index, 0, tab); 620 621 604 this.fireEvent("addTab", tab); 622 605 … … 676 659 Controls.TabControl.TabPage = Class.create(Control, App.History.Node.prototype, { 677 660 initialize: function($super, caption) { 678 if (!caption) {679 return;680 }681 682 661 $super(new Element("div")); 683 662 … … 711 690 Controls.TabControl.TabPageWithButtonControl = Class.create(Controls.TabControl.TabPage, { 712 691 initialize: function($super, caption, icon, buttonClass) { 713 if (!Object.isString(caption)) {714 return;715 }716 717 692 this.icon = icon; 718 693 this._buttonClass = buttonClass || "menuItem"; … … 738 713 Controls.View = Class.create(Controls.TabControl.TabPageWithButtonControl, { 739 714 initialize: function($super, caption, icon, title, options) { 740 if (!Object.isString(caption)) {741 return;742 }743 744 715 this.setOptions({ hasAdditionalCommands: true }, options); 745 716 $super(caption, icon); … … 847 818 setHelpText: function(text) { 848 819 this.help.innerHTML = text; 849 },850 851 getHelpText: function() {852 return this.help.innerHTML;853 820 } 854 821 }); … … 937 904 938 905 this.element.observe("submit", this._onSubmit.bind(this)); 939 940 906 this.element.observe("keypress", (function(e) { 941 907 if (e.keyCode === Event.KEY_RETURN) { … … 1144 1110 document.observe("mouseup", this.stopDraggingListener); 1145 1111 document.observe("mousemove", this.moveListener); 1112 1113 this._windowSize = Tools.getWindowSize(); 1146 1114 } 1147 1115 }, … … 1156 1124 }, 1157 1125 1158 move: function(e) { 1159 if (this.draging && e) { 1160 var windowSize = Tools.getWindowSize(); 1161 1162 var clientX = e.clientX.limitTo(0, windowSize.width); 1163 var clientY = e.clientY.limitTo(0, windowSize.height); 1164 1165 this.target.setStyle({ left: this.offsetX + clientX - this.x + "px", top: this.offsetY + clientY - this.y + "px" }); 1126 move: function(event) { 1127 if (this.draging && event) { 1128 var clientX = event.clientX.limitTo(0, this._windowSize.width); 1129 var clientY = event.clientY.limitTo(0, this._windowSize.height); 1130 1131 this.target.setStyle({ 1132 left: this.offsetX + clientX - this.x + "px", 1133 top: this.offsetY + clientY - this.y + "px" 1134 }); 1166 1135 } 1167 1136 }, … … 1253 1222 update: function(content) { 1254 1223 this.content.innerHTML = content; 1255 },1256 1257 /**1258 * @method Zentriert das Steuerelement basierend auf seiner Grösse im Browserfenster (Wrapperfunktion).1259 * @return {ExtendedHTMLObject} Das HTML-Element des Steuerelement.1260 */1261 centerOnScreen: function() {1262 return this.element.centerOnScreen();1263 1224 }, 1264 1225
Note: See TracChangeset
for help on using the changeset viewer.