mootools

Inserting a Div Into another Div?

假装没事ソ 提交于 2019-12-23 07:40:16
问题 Im creating a web app and would like to know why the following code is not working. It first creates a element which is then added to the body. I then create another Div element which i would like to place inside the first div element that i created. Im using MooTools classes to create and initialize objects and it works fine but i just cant seem to get the following code to work. The code is inside an initialize: function() of a class: this.mainAppDiv = document.createElement("div"); this

JSON.stringify() - Escaping Issue

青春壹個敷衍的年華 提交于 2019-12-23 04:04:28
问题 I am currently using AJAX with JQuery to send json to an API server. However, there seems to be an issue with a server that is escaping the JSON string when I use JSON.stringify() but on another server when using the exact same code it works without any problems. Here is an example of the Javascript object that I am using stringify on: {"jsonrpc":"2.0","method":"get_contacts","params":["4345ert343t34t34t4e564", {"campaigns":["AI5D"]}],"id":1} I am working from the examples here https://github

JavaScript converting plain text to links && smilies

爱⌒轻易说出口 提交于 2019-12-23 03:59:12
问题 Working example: http://alpha.jsfiddle.net/gTpWv/ Both of the methods work separately, but once regexp for smilies gets raw HTML code to process, things get ugly. K = K.replace(/\b((http:\/\/)|(www\.))[^ ]{5,}/g, function (x) { var b = x; if (b.indexOf("www") == 0) { b = "http://" + b } return '<a href="' + b + '" target="_blank">' + x + "</a>" // K is now /"Testing <a href="http://www.google.com," target="_blank">http://www.google.com,</a> :D, ^^"/ for (var d = 0; d < smiliesArray.length; d+

How to changing my background-image css property using Mootools?

久未见 提交于 2019-12-23 01:16:06
问题 I am newbie。 How to changing my background-image css property using Mootools? 回答1: Example, on page load: <div id="yourElement"></div> <script type="text/javascript"> window.addEvent('domready', function() { $('yourElement').setStyle('background-image', 'url(path/to/your/image)'); }); </script> 回答2: The MooTools docs for Element.Style should be able to answer this one for you. 回答3: window.addEvents({ // fire when the DOM is loaded domready: function(){ // path to the image var

Unsafe Javascript Access from Iframe in Chrome Extension

寵の児 提交于 2019-12-22 17:49:06
问题 I'm building a Chrome Extension that will be using Iframes that load Flash content. Using Mootools in the Iframe, I'm creating a .swf object and then injecting it into itself. This Iframe, main.html, is inserting the flash object like so: window.addEvent("domready", function () { var flashContainer = $("flash-container"); new Swiff("http://www.example.com/content.swf", { "width":"100%", "height":"90%", "id":"flash-content" }).inject(flashContainer); }); This produces the following error:

How far can you go with JavaScript testing?

不打扰是莪最后的温柔 提交于 2019-12-21 20:16:13
问题 I'm somewhat informed with TDD and BDD with Ruby/Rails, but I will eventually need to use some form of testing with my JavaScript code. I use MooTools as a JS framework and I absolutely love how well I can organize and modularize my code with its codebase. But, sometimes, when I add new features to my application, I find that the functionality can easily break from how it worked before. When it comes to testing JavaScrtpt code, does the testing itself fall short of user interaction? Is it

Creating a grid overlay over image

拈花ヽ惹草 提交于 2019-12-21 16:23:01
问题 I made a script (using mootools library) that is supposed to overlay an image with a table grid and when each grid cell is clicked/dragged over its background color changes 'highlighting' the cell. Current code creates a table and positions it over the element (el, image in this case). Table was used since I am planning to add rectangle select tool later on, and it seemed easiest way to do it. <html> <head> <title></title> <script type="text/javascript" src="mootools.js"></script> <script

How to detect when an element over another element in JavaScript?

安稳与你 提交于 2019-12-21 12:31:55
问题 I wrote most of the code... And when the element is "fully" over the other element it works. The problem is that I don't just want it to be true when the element is "fully" over the element, I also want it to be true when the element is partly over the other element. Here is my code: element = this.element.getStyles('left', 'top', 'width', 'height'); elementLeftX = element.left.toInt(); elementLeftY = element.top.toInt(); elementRightX = (element.width.toInt() + element.left.toInt());

How different is Ext JS from others like jQuery and Mootools

对着背影说爱祢 提交于 2019-12-21 04:24:38
问题 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? 回答1: 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

Embed youtube video without youtube link

点点圈 提交于 2019-12-21 02:04:29
问题 as you know that when you Embed youtube video in your web page, it works fine , but if you click on any part of screen, youtube website will open in new window. is there any way to Embed youtube video in our website, but disable that youtube website opening when click on screen to pause the video? or you can play you tube video in other player..? i am looking for way around it. any way possibility in j query, ajax, java script or PHP, mootools etc. Thanks 回答1: try this: it is from youtube API