mootools

Check whether some element is “focused” without jQuery

∥☆過路亽.° 提交于 2019-12-04 07:30:56
I was almost sure I could find the answer here, but I wasn't successful. How would you check whether is there some object selected (focused) on the moment of the event call? I tried if (document.activeElement == "[object HTMLBodyElement]") , but apparently the .activeElement is being filled onLoad. I am not allowed to use jQuery, only mootools. Thanks a lot for the help! https://developer.mozilla.org/en/DOM/document.activeElement - as pointed out, if no element is focused, the document body is focused by default: if (document.activeElement != document.body) { // something else than the body is

Ajax replace text with image

◇◆丶佛笑我妖孽 提交于 2019-12-04 06:16:14
问题 I have put together the following mootools script window.addEvent('domready', function() { var shouts = "timed.php"; var log = $('log_res'); function updateData (url,target) { new Ajax(url,{ method: 'get', update: $(target), onComplete: function() { log.removeClass('ajax-loading');} }).request(); log.empty().addClass('ajax-loading'); } var update = function(){ updateData ( shouts, 'log_res' ); }; update(); // call it immediately update.periodical(10000); // and then periodically }); heres the

Javascript slide effect onclick

五迷三道 提交于 2019-12-04 05:24:52
问题 I'd like to add a slide & fade effect to a DIV, with purely Javascript, using "onclick". The code is here: http://jsfiddle.net/TCUd5/ The DIV that has to slide has id="pulldown_contents_wrapper". This DIV is contained in a SPAN, that also triggers it: <span onclick="toggleUpdatesPulldown(event, this, '4');" style="display: inline-block;" class="updates_pulldown" > <div class="pulldown_contents_wrapper" id="pulldown_contents_wrapper"> And I think the JS code that controls the SPAN onclick is:

jQuery与mootools共存冲突解决

假装没事ソ 提交于 2019-12-04 03:48:40
jQuery与mootools共存冲突解决 方式一: <html> <head> <script src="prototype.js"></script> <script src="jquery.js"></script> <script> jQuery.noConflict(); // Use jQuery via jQuery(...) jQuery(document).ready(function(){ jQuery("div").hide(); }); // Use Prototype with $(...), etc. $('someid').style.display = 'none'; </script> </head> <body></body> </html> --------------------------------------------------------------------------------------------------- 方式二: <html> <head> <script src="prototype.js"></script> <script src="jquery.js"></script> <script> var $j = jQuery.noConflict(); // Use jQuery via $j(...)

Getting correct mouse position in a CSS scaled canvas

旧时模样 提交于 2019-12-03 20:08:13
I have been trying to take the logic of a couple simple MooTools operations and convert it to work with jQuery. The logic I want is for this jsfiddle what it allows is to get accurate mouse position on a canvas element with css resizing. I found the answer here on SO I have been working for a couple hours with no avail I think I understand his logic but fitting for some reason I am not seeing results Here is what I have done so far with arby's logic from his answer commented out // Get the change ratio for the new css set size //var cssScale = [canvas.getSize().x / canvas.get('width'), canvas

Javascript object dependencies

天大地大妈咪最大 提交于 2019-12-03 17:24:26
In complex client side projects, the number of Javascript files can get very large. However, for performance reasons it's good to concatenate these files, and compress the resulting file for sending over the wire. I am having problems in concatenating these as the dependencies are included after they are needed in some cases. For instance, there are 2 files: /modules/Module.js <requires Core.js> /modules/core/Core.js The directories are recursively traversed, and Module.js gets included before Core.js , which causes errors. This is just a simple example where dependencies could span across

clone table row

不问归期 提交于 2019-12-03 16:04:23
How can i use javascript (i assume) to clone a table row like ive beautifully illustrated in the picture below? You can hookup a live event to all the buttons. If you give them a class of clone for instance the following will work. $('input.clone').live('click', function(){ //put jquery this context into a var var $btn = $(this); //use .closest() to navigate from the buttno to the closest row and clone it var $clonedRow = $btn.closest('tr').clone(); //append the cloned row to end of the table //clean ids if you need to $clonedRow.find('*').andSelf().filter('[id]').each( function(){ //clear id

How different is Ext JS from others like jQuery and Mootools

*爱你&永不变心* 提交于 2019-12-03 13:05:02
When looking at Ext JS, I don't get the feeling that it's meant for the same things as jQuery and Mootools. Whilst jQuery and Mootools help with the general workings of a site, Ext JS seems to be focussed on tables and storing data, plus manipulating it. So, is this observation correct, or is Ext Js fit for the same work as jQuery and Mootools? Steve -Cutter- Blades Comparing ExtJs and JQuery is like comparing apples and oranges. You can compare Ext Core to JQuery, and ExtJs to JQuery UI. Ext Core and ExtJs are Open Source, with Core being under an MIT license and ExtJs falling under the GPL 3

MooTools - Programmatically fired events not working with event delegation

大兔子大兔子 提交于 2019-12-03 13:04:24
问题 Would really appreciate if anyone can help me figure out why I am unable to fire events programmatically when using event delegation in MooTools (from the Element.Delegation class). There is a parent <div> that has a change listener on some child <input> elements. When the change event is triggered by user actions, the handler on the parent div gets triggered, but when I fire it programmatically with fireEvent on any child input, nothing happens. The basic setup is: html <div id="listener">

Select and add class in javascript

心不动则不痛 提交于 2019-12-03 12:49:47
问题 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')