You can also tell Unpoly to treat that one link as a vanilla Javascript link...
...page may load without assets. The dev server will detect any changes to your JavaScript and CSS and re-compile automatically. When it is done automatically any browser window showing...
...have a dev server running and call any helper that accesses asset paths (e.g. javascript_pack_tag or image_tag), Rails will compile your entire assets within its process before...
...also namespaces files compiled files inside a pack CSS files are stored inside css, JavaScripts inside js and images inside media If you namespaced your pack's contents like /your-pack-name/images...
...commit messages, add a new link "Commit" to your bookmarks and use the following Javascript as the link URL: javascript:(function() { let storyTitles = []; let stories = Array.from(document.querySelectorAll('.story[data-selected...
...menu for copying and pasting will appear. This can confuse unexperienced users. Use the Javascript hack below to disable text selection on mobile devices: // Deactivating distracting Text Selection:
...making a vanilla form submission to a hidden and try to wrap a nice Javascript API around this. I found it really hard to make this work reliably.
...a nice data attribute to the form fields, and look for that in your JavaScript code: document.on('change', '[data-requires-update]', updateThings); If you are interested in the element that...
...a great enhancement when you want users to supply some kind of code (HTML, JavaScript, Ruby, etc). It offers syntax highlighting and some neat features like auto-indenting.
...some utility functions for DOM manipulation and traversal in the up.element module. Further reading JavaScript without jQuery (presentation from...
...openTasks = $.find('.task.open', container); Note that Sizzle returns vanilla DOM nodes in a vanilla Javascript array. It does not return jQuery collections...
...will break after modifying the collection like above. The following solution works. It uses JavaScript methods which modify the object in place, thus keeping any extra attributes: var index = element.indexOf...
...mind that the above examples use jQuery. Tweak accordingly if you are using another JavaScript framework...
scope.paragraphs = _.map paragraphs, (lines) -> lines.split('\n') Also see simple_format helper for Javascript...
...this, you simply cannot clone instances of Coffeescript instances as you would clone other Javascript hashes. If you need cloning, you would probably need to implement a clone() method in...
...some kind of pre-processing. You could probably also hack together a solution in JavaScript which downloads the background image file, rewrites the XML string and generates a data: URI...
...use Semantic Versioning's naming convention. If your library has both a Ruby and JavaScript component and you want to use the same version constant for both, you can use...
= form.file_field :add_images, class: 'hidden', multiple: true Add Images = gallery_form.submit Javascript Now to the dynamic part. I built it with an Unpoly compiler, but the code...
...so you can both use up the entire quota. Note that the Google Maps Javascript API (the one that draws maps on the screen) has a different quota policy. Here...
You can include files from app/assets or from the public folder with javascript_include_tag. The subtle difference that tells rails how to build the path correctly is a single...
...slash at the beginning of the path: <%= javascript_include_tag('ckeditor/config') %> # for assets/ckeditor/config.js <%= javascript_include_tag('/ckeditor/ckeditor') %> # for public/ckeditor/ckeditor.js This also applies to stylesheet_link_tag. Note that when you...
...or close the dialog. The easiest way to interact with the editor is via javascript postMessages. To abort the dialog a post message on click with an event listener like...
...any CSS that contains directives like background-image: url(/internal-path/wallpaper.png) will be break Referenced javascripts or stylesheets will probably attempt to load from the wrong URL The solution to this...
...below are from Holly. This is the feature that tests Holly's print stylesheet: @javascript Scenario: When printing a tree, the page appears black on white with all controls hidden...
...jQuery cache even exists. After all jQuery could simply attach event handlers to the Javascript object that represents the DOM element. The reason for the existence of the jQuery cache...
...is that old versions of Internet Explorer could not garbage-collect Javascript objects with circular references. For instance, the following object graph could not be reclaimed by old IE's...
...this, test for the right environment and place the JS-code afterwards: - if Rails.env.production? :javascript var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); _gaq.push(['_trackPageview...