mootools

What does MooTools' Function.prototype.overloadSetter() do?

笑着哭i 提交于 2019-12-03 11:33:56
问题 I'm looking through the MooTools source to try and understand its .implement() and .extend() utilities. The definition of each refers to a function defined like this: var enumerables = true; for (var i in {toString: 1}) enumerables = null; if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; Function.prototype.overloadSetter = function(usePlural){ var self = this; return function(a, b){ if (a ==

Programmatically determine DPI via the browser?

孤人 提交于 2019-12-03 10:06:01
I would like to programmaticaly determine the DPI of a user's display in order to show a web page at a precise number of units (centimeters/inches). I know it a weird request: it's for a visualization research project and it's kind of a control. We currently do it by having the user place a credit card to the screen and match a resizable div (via Mootools) to the real credit card, and voila we can get the DPI and display the page correctly. Can anyone think of a programmatic way to do this? Randolpho If you're doing this in javascript/mootools, CSS units are your friend. You can specify sizes

Should I convert from MooTools to jQuery? [closed]

喜夏-厌秋 提交于 2019-12-03 10:03:18
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I have a fairly large codebase that depends on MooTools v1.11 and am about to convert to version 1.2. Since this is a pretty major overhaul, I've toyed with the idea of converting to jQuery. Anyone have advice on whether to update to jQuery or just stick

What are your favorite Mootools/Prototype native object prototypes? [closed]

↘锁芯ラ 提交于 2019-12-03 09:38:12
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Us Mootoolers and Prototypers (what few are on this site) usually carry around a handy toolbox of functions we have created (or

Will existing JavaScript frameworks incorporate CommonJS?

旧街凉风 提交于 2019-12-03 09:14:31
问题 JavaScript frameworks like Prototype, jQuery, YUI, MooTools, Dojo, et al. all seem to target client-side developers, with the focus on enabling common user interaction patterns to be implemented more efficiently and with less code. With the emergence of server-side JavaScript, do these frameworks intend to incorporate the CommonJS standards to enable reuse of their library functions for server-side JavaScript, or will they allow alternative frameworks like Node and Narwhal to handle the

Firefox 18 breaks mootools 1.2.5 selector engine

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Working jsfiddle example here: http://jsfiddle.net/CfJyd/ The problem only occurs in Firefox 18 that I know of. The following html: <div class = "test" > Test Div </div> <div class = "testIgnore" > This should stay the same </div> With this js: window . addEvent ( 'domready' , function () { $$ ( '.test' ). set ( 'html' , 'Only Test should update' ); }); Results in this output: Only Test should update Only Test should update Upgrading to Mootools 1.4.5 isn't an option at the moment because of lots of plugins that use 1.2.5, can

Best practices for static methods and variables with MooTools classes

我与影子孤独终老i 提交于 2019-12-03 06:43:37
Are there any best practices or common solutions to adding support for "static" methods and variables to MooTools-generated classes? In particular, is there any solution that ensures that static initialization takes place before the instance initialize method is called? Caveat: Never used MooTools. I've used Prototype a fair bit, though, which has a similar Class system (MooTools is either "inspired by" or a fork of Prototype, depending on who you ask). Just add them as properties on the resulting "class": var MyClass = new Class(properties); MyClass.staticMethod = function() { // ... }; (The

Javascript library for building desktop-like web application: ExtJS, jQuery, YahooUI, Mocha, SproutCore, Cappuccino, others? [closed]

浪尽此生 提交于 2019-12-03 03:14:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am evaluating several Javascript UI toolkits for building web applications that have a desktop-like feel, mainly because of dialogs and window management. I looked at several options - here are my evaluations so far: ExtJS - Great widget library, great docs! Not so great license. jQuery UI - Lack of ready-made

Select and add class in javascript

笑着哭i 提交于 2019-12-03 03:12:20
Cross Platform if possible, how can I select classes in Javascript (but not Jquery please -MooTools is fine though-) on code that I can't add an ID? Specifically, I want to add the class "cf" on any li below: HTML <div class="itemRelated"> <ul> <li class="even"> <li class="odd"> <li class="even"> I tried to fiddle it but something is missing: Javascript var list, i; list = document.getElementsByClassName("even, odd"); for (i = 0; i < list.length; ++i) { list[index].setAttribute('class', 'cf'); } JSFiddle ps. This question phenomenally has possible duplicates , (another one ) but none of the

Mootools equivalent of jQuery toggle()?

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using trying to use mootools for a quick task of toggling some text on click. But I can't seem to find a Mootools equivalent of jQuery's toggle() function. What I'm trying to do is as follows: $('a#id').toggle( function() { $(this).set('html', 'new text'); }, function() { $(this).set('html', 'old text'); } ); How would I modify the above code for mootools? Thanks! 回答1: As far as I know that "toggle" on mootools doesn't exists. You could "implement" it, by this way for example: http://www.jsfiddle.net/steweb/rdvx8/ Is this what you'd like