mootools

Rails not choosing the right layout for javascript requests

坚强是说给别人听的谎言 提交于 2019-12-10 12:04:45
问题 I have two different layouts in my app, one for javascript (AJAX) requests and one for regular requests. # application.html.haml for non-js requests (abbreviated) !!! %html %head %body = yield # and application.js.coffee for js requests App.modal """<%= yield %>""" # creates a javascript modal Any link with :remote => true should in theory use the javascript layout. This DOES work on certain occasions, but does not work on others. It works for this link: %li= link_to "Login", new_user_session

Copying styled text from a page to the clipboard with Javascript

混江龙づ霸主 提交于 2019-12-10 11:47:56
问题 I've created a simple tool so employees can personalize their company email signature. This tool creates some styled text with some bolded fonts and a bit of color, nothing fancy. If I then select the text and copy and paste it into my Gmail signature field all works well. It retains the formatting. However, I'd prefer to give the user the option of clicking a "Copy" button that copies the formatted content onto their clipboard. I'm currently using ZeroClipboard to add the "copy to clipboard"

Mootools class variable scope

烂漫一生 提交于 2019-12-10 10:43:28
问题 Take this class: var MyClass = new Class({ Implements: [Events, Options], initialize: function() { this.a = 1; }, myMethod: function() { var mc = new differentClass({ events: { onClick: function() { console.log(this.a); // undefined (should be 1, 2, 3 etc) this.a ++; } } }); } }); How do I keep the value of this.a ? I am basically trying to draw a line (using canvas) from the last point to the co-ordinates just clicked. [EDIT] I dont want to bind this as it's bad apparently and it will over

Mootools Request getting “501 Unsupported method ('OPTIONS')” response

余生长醉 提交于 2019-12-10 10:35:57
问题 I have this mootools request: new Request({ url: 'http://localhost:8080/list', method: 'get', }).send(); and a small python server that handles it with this: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import subprocess class HttpHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path == '/list': self.list() else: self._404() def list(self): self.response200() res = "some string" self.wfile.write(res) def _404(self): self.response404() self.wfile.write("404\n") def

MooTools and jQuery integration

不问归期 提交于 2019-12-10 09:48:53
问题 I am using the code MooTools (1.11) and jQuery (1.2.6). It's working fine when these are separate. While I am integrating Firefox, it throws: (document).ready(){} is not a function. Is anything wrong in my concept? What do I do to rectify it? 回答1: jQuery.noConflict(); jQuery(function($){ $works with jQuery here. }); $ Works with MooTools here. However, that said, I would suggest you ditch the MooTools. Its complete modification of all object prototypes can cause cause jQuery's functions to

Jsonp with MooTools

巧了我就是萌 提交于 2019-12-09 23:57:27
问题 I'm learning javascript and now I'm trying to work with mootools. I would like to work with json files in remote so I'm trying to use jsonp. Right now I have a textbox and when I click a button I would like to make a request of a json file. The url of the json file is something like www.mysite.com/json/sometext where sometext is the content of the textbox. The problem is that I don't really understand how the request and mootools work. Right now I don't have the code because I don't know how

Strange mootools window dragging behaviour

走远了吗. 提交于 2019-12-09 22:32:02
问题 I have a drag-able mootools modal window. The content of the window is a iFrame. I drag the window from inside the iFrame. (it drags but shakes a lot during dragging) Live link here . Question : why this strange drag behaviour? the iFrame leaves its border, empty, on the origin place. How to avoid this? Thankfull for ideas/tips on were to search for problem. My code: window.addEvent('domready',function() { document.getElementById('iframe2_footer').addEventListener('mousedown', mouseDown,

where does __proto__ get added to array?

那年仲夏 提交于 2019-12-09 19:52:22
问题 used to be able to do this without any problems: for (data in dataArray) { // do some stuff }; now, it suddenly is iterating through this __proto__ array that got added to my dataArray . where the hell did it come from? is this from using the MooTools library? it's breaking all my loops! :P now i have to do this instead: for (var i=0; i < dataArray.length; i++) { // do some stuff }; the thing i DO NOT get is why this works... does __proto__ not actually count as an array element? if not, then

Programmatically determine DPI via the browser?

老子叫甜甜 提交于 2019-12-09 07:57: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?

Prototype / Mootools conflict question

牧云@^-^@ 提交于 2019-12-09 00:03:07
问题 So I have a page that uses both Prototype and Mootools AJAX scripts. There is much more Mootools that Prototype, so I'm wondering if Prototype has a function similar to jQuery's $j = jQuery.noConflict(); that I can use to redefine the $ alias for Prototype? Thanks! 回答1: The newest version of MooTools has a no conflict mode. Unfortunately, Prototype does not, which means that the $ will have to be bound to Prototype. To enable the Dollar Safe Mode, upgrade your version of MooTools and make