Magic Icon Magic JavaScript

Quick Jump ↵

A simple to install, easy to use, JavaScript library/framework with loads of built-in functionality.

These docs are not guaranteed to be complete or accurate

Your job…

  1. Review online documentation.
  2. Download: .
  3. Unzip and upload to your website.
  4. Follow usage instructions below and as needed.
Usage

Review, tweak and add the code below inside your <head> tag…

Notes

Magic JS is built around HTML5's data- attribute – don't stuff your tags full of invalid code. :)

$m.construct() is passed an object full of settings. Below are descriptions for ones that aren't overly self-explanatory:

  • global_debug - turns on global debugging via pop-up window.
  • animations.use - determines if CSS/JavaScript transitions are used. Some $m.wand and $m.trick items use these and some don't.
  • ajax.debug - turns on AJAX debugging, set to true and also be sure global_debug is set to true.
  • ajax.visual - determines if the CSS class ajax_visual is applied to the element making the request.
  • ajax.timeout - determines how long Magic will wait before giving up on a request.
  • geo.use - turns on Geolocation support, set to true.
  • geo.debug - turns on Geolocation debugging, set to true and also be sure global_debug is set to true.
  • geo.visual - determines if the CSS class geo_visual is applied to the element making the request.
  • send_timezone_to - after the page loads, Magic will insert a <script> tag with the src attribute set to this value along with ?tz= and the browser's timezone.

It's not required to include the wand..js on your page. However, all the built-in functionality for Easies, Forms and AJAX lives there.

Be sure to include a unique id attribute on tags you add the data-mjf to, otherwise the magic will probably not work the way you expect or want them to.

The data-mjf values are followed like a chain and will return true, executing each event until finished. This includes the default element action — onclick, onsubmit, etc.

  • As an example, if you have <a href="http://www.google.com" data-mjf="lightswitch">, the href will be followed since it's the default action.
  • To stop the default action, add data-mjf="MAGIC|return_false" to your tag. This should be noted throughout the examples.
  • The data-mjf values also DO NOT act independently of one another with regards to return values. If one returns false, the remaining WILL NOT be executed.
  • Review the Multiple Magics to learn how to chain functionality.

If the site uses Google Analytics, Magic JS will send click tracking for the following Darkroom, Dynamic Tabs, Open New Win and all AJAX requests by default.

  • Add data-mjf_ga_track="false" if you don't want Google Analytics to track the particular item.
Contact

hi@magicjs.com serious inquiries only, no jokers.

Easy examples of core functionality

Confirm Click — Bring up an Ok or Cancel confirmation box
$m.wand.confirm_click

Confirm Unload — Let the visitor know they're about to navigate away
$m.wand.confirm_unload

CSS Class Update — Easily change an element's CSS class
$m.wand.css_class_update

Deferred Load
$m.wand.deferred_load

Dropdown Menu
$m.wand.dropdown_menu

Dynamic Tabs
$m.wand.dynamic_tabs

Empty Element (via click) — Clear an element's innerHTML
$m.wand.empty_onclick

Fire Any Event
$m.wand.fire_event

Frame Reload
$m.wand.frame_reload

Geolocation
$m.wand.geo_get

Google Analytics Click Tracking
$m.wand.ga_click_track

HTML5 Audio
$m.wand.html5_audio

HTML5 Video
$m.wand.html5_video

Image Rollovers
$m.wand.img_rollovers

Light Switch
$m.wand.lightswitch

Open New Windows
$m.wand.open_new_win

Print the Page (via click)
$m.wand.print_onclick

Print the Page (via load)
$m.wand.print_onload

Remove Element (via click) – Delete an element entirely from the DOM
$m.wand.remove_onclick

Same Height — Resize a parent's kids to be the same height
$m.wand.same_height

Smooth Scroll To
$m.wand.smooth_scroll_to

Simple Image Slideshow
$m.wand.img_slideshow

Text Resizer
$m.wand.text_resize

Tool Tips
$m.wand.tool_tip

Working with forms and fields

Add Commas
$m.wand.add_commas

Changed Form Alert – Alert the visitor when navigating away from a changed form
$m.wand.form_changed_alert

Change Field Type
$m.wand.change_field_type

Check All Checkboxes
$m.wand.check_all_boxes

Check Another Field On Focus
$m.wand.check_other_onfocus

Checked Picker
$m.wand.checked_picker

Clear All Fields (via click)
$m.wand.clear_onclick

Clear Individual Fields (via focus)
$m.wand.clear_onfocus

Clear Individual Fields (via load)
$m.wand.clear_onload

Copy Fields from One to Another
$m.wand.copy_fields

Copy a Field's Value to another Element's innerHTML
$m.wand.copy_value_to_html

Convert Fields to URL Friendly Fields
$m.wand.s2lcus

Elastic Textareas
$m.wand.elastic_textareas

Enable/Disable Fields when Clicking Another Field
$m.wand.click_enable_disable

Form Submission (via click)
$m.wand.submit_onclick

Form Validation
$m.wand.form_required

Password Stength Checker
$m.wand.password_strength_checker

Built-in AJAX magic

AJAX On Change
$m.wand.ajax_change

AJAX On Click
$m.wand.ajax_click

AJAX On Load
$m.wand.ajax_onload

AJAX Polling
$m.wand.ajax_polling

AJAX Unload
$m.wand.ajax_unload

Field Submission (via click)
$m.wand.ajax_field_submit_click

Field Submission (via keyup/change)
$m.wand.ajax_field_submit_kc

Form Submission
$m.wand.ajax_submit

Form Submission (via click)
$m.wand.ajax_submit_link

Form Submission (via keyup/change)
$m.wand.ajax_submit_kc

Input On Keyup/Change
$m.wand.ajax_kc

Predefined JSON parsing
Magic can parse a returned JSON object if you want to do more advanced things with the returned data

Notes

Requests will send a unique name/value pair to the server. This will be something like ajax_call=1322598771903.

Requests are queued automatically for delivery by the browser based on the visitor's request order.

The data-mjf_ajax_XYZ attributes are…

  • data-mjf_ajax_call_on_success="FUNCTION_NAME"
    • custom JavaScript callback after a successful AJAX request
    • defaults to $m.ajax.simple_content_update
    • use data-mjf_ajax_call_on_success="magic_json" to use the Predefined JSON parsing
  • data-mjf_ajax_form_reset="true(OR)false"
    • applies only to Form Submit
    • defaults to false
  • data-mjf_ajax_method="get(OR)post"
    • applies to everything but Form Submit
    • defaults to get
  • data-mjf_ajax_query="NAME=VAR&NAME_2=VAR_2"
    • applies to everything but Form Submit
    • any query variables you'd like to pass to the server
  • data-mjf_ajax_timeout="N"
    • With N being the number of seconds before the request times out and a message is appended to the data-mjf_ajax_update_id
    • defaults to ajax.timeout set in the main $m.construct() method.
  • data-mjf_ajax_update_id="ELEMENT_ID"
    • the element id where the returned server data will be put
    • * required unless using data-mjf_ajax_call_on_success="magic_json"
  • data-mjf_ajax_update_id_action="overwrite(OR)append(OR)prepend"
    • overwrite, append or prepend the current content in data-mjf_ajax_update_id
    • defaults to overwrite
  • data-mjf_ajax_update_id_scroll_top="true"
    • scroll to the top of the data-mjf_ajax_update_id after a successful AJAX request
      - useful if your update_id uses the CSS overflow property
    • defaults to false
  • data-mjf_ajax_update_id_scroll_to="true"
    • scroll to the data-mjf_ajax_update_id after a successful AJAX request
    • defaults to false
  • data-mjf_ajax_username="USERNAME"
    • be careful using username and password
    • defaults to false
  • data-mjf_ajax_password="PASSWORD"
    • defaults to false
  • data-mjf_ajax_url="/PATH/TO/SERVER/SCRIPT/"
    • applies to everything but Form Submit
    • * required
Extending that core functionality

Darkroom () — Showing all kinds of content in a pop-up

Drag N Drop () — Move stuff around

Gmaps () — Talk to Google Maps

Magic Calendar () — Save the date in a pop-up you can actually see

Magic Charts () — Charting with <canvas> and <svg> coming soon

Magic Editor () — Formatting content in a rich-text editor

Magic Ratings () — Star it like a pro

Motion () — Animation prototypes

New Form Fields () — Creating new form fields on the fly

String Deposit () — Insert text strings into the Magic Editor and other form fields

Under the hood changes

The older the version, the less likely the version notes will be accurate.

14.7.24

13.10.28

  • magic.13.10.28.zip
  • New Elastic Textareas to grow and shrink them based on their content length.
  • HTML5 Video now sets the <video> to the dimensions defined in the data-mjf_h5v_dims attribute.
  • Form Validation now supports the new HTML5 input types: color, date, datetime, datetime-local, email, month, number, search, tel, time, url, and week.
  • Fixed a bug where IE10 would sometimes fail to replace selections.

13.5.21

  • magic.13.5.21.zip
  • Ensured all internal arrays were re-initialized correctly during AJAX requests.
  • New $m.tag.get_body(IN_PARENT) method which returns a document's body element.
  • New $m.tag.get_head(IN_PARENT) method which returns a document's head element.
  • New $m.tag.remove_children(TAG_ID) method which removes all child nodes from an element.
  • Updated $m.tag.html(IN_ID, IN_CONTENT, IN_HOW, IN_ENCODED) to more reliably append, prepend and replace content. IN_CONTENT can now also be a collection of nodes in addition to being a string.
  • Updated the CSS classes .lightswitch_block and .lightswitch_none with cursor:pointer !important.

13.4.23

13.3.28

  • magic.13.3.28.zip
  • New AJAX On Load in the AJAX section.
  • New $m.app_cache.available variable to tell if the browser supports offline websites. Defaults to false.
  • New $m.vd.is_online variable to tell if the browser is online or not. Defaults to true.
  • Updated versions of the Darkroom, Magic Calendar and Magic Editor tricks.
  • Updated $m.tag.get_iframe_doc() to be more stable.

13.3.26

  • magic.13.3.26.zip
  • New Deferred Load in the Easies section.
  • New $m.storage.get.page_code(IN_STRING) for record identification.
  • New $m.storage.remove(IN_TABLE, IN_ID) for remove records.
  • Fixed Dropdown Menu touch-based browser support. There's a new stylesheet and the CSS class name has changed, please update your code.
  • Records utilizing $m.storage are now deleted auto-magically for Dynamic Tabs, Light Switch and Text Resizer if they no longer apply on a specific page.
  • Converting Fields to URL Friendly Fields now removes single and double curly quotes before the conversion.
  • Language files for the Tricks are now loaded better.

13.3.19

13.2.8

12.12.21

  • magic.12.12.21.zip
  • Updated $m.tag.replace(IN_OLD, IN_NEW) &ndashed this will break your code if you're using this method.
  • Fixed the $m.cursor.set(IN_ID, IN_POS) bug where the cursor would only be set to the beginning or ending.
  • Removed the $m.config.ajax.use property since it was no longer being used.
  • New $m.selection.replace(IN_HTML, IN_DOCUMENT).
  • Removed $m.insert_node_at_selection_point() since the above method is faster, more reliable and more flexible.
  • Fixed the undefined result_set variable in $m.storage.
  • New $m.tag.get_iframe_doc(in_id).
  • Updated $m.tag.create(IN_PARENT, IN_TYPE, IN_ATTS, IN_HTML, IN_WHERE, IN_DOCUMENT) to allow for different document element creation.
  • Fixed the Text Resizer JS error thrown when the data-mjf_resize_id="" didn't have a default style property.

12.12.14

  • magic.12.12.14.zip
  • New AJAX Field Submission (via keyup/change) in the AJAX section.
  • Fixed the AJAX Form Submission bug that didn't send the form fields to the server.
  • Fixed the Confirm Unload bug that would throw a JavaScript error if the language file hadn't loaded.
  • Fixed the Light Switch bug that didn't respect the data-mjf_lswitch_animate_increments="0" attribute to disable the animation.
  • Updated Dropdown Menu to support touch-based browsers.
  • Updated Tool Tips to support touch-based browsers.
  • Disabled most animations on touch-based browsers — too slow at the moment.

12.12.12

12.12.11

  • magic.12.12.11.zip
  • Fixed the form action bug in AJAX Form Submission (via click) and AJAX Form Submission (via keyup/change)
  • All AJAX query string variables are now properly encoded.
  • Better exisiting class matching in $m.css_class.add(IN_ID, IN_CLASS).
  • The Magic Debugger will now attempt to pass entries to the console.log() for touch-based browsers.
  • New $m.event.get(IN_EVENT) and $m.event.get_target(IN_EVENT).
  • Removed $m.get_query_string(IN_OBJECT).
  • New $m.query_string.create(IN_OBJECT) and $m.query_string.parse(IN_STRING).
  • Added the shift key as a worthy keycode.
  • New $m.tag.get_prev_sibling(IN_ID) and $m.tag.get_next_sibling(IN_ID).
  • More reliable detection of touch-based browsers.

12.11.29

  • magic.12.11.29.zip
  • New Confirm Unload in the Easies section.
  • New Geolocation in the Easies section.
  • New AJAX Form Submission (via keyup/change) in the AJAX section.
  • New $m.query_string.create(IN_OBJECT).
  • New $m.is.good_string(IN_OBJECT).
  • New $m.storage.create.data_record(IN_ID, IN_COLUMN, IN_VALUE).
  • New $m.storage.get.page_tiny_id(IN_STRING).
  • New $m.ut.friendly_url(IN_STRING).
  • Completed rewritten AJAX engine. The monolithic object code has been replaced with a var my_ajax = new $m.ajax() model. This will break your code if you've written custom JS and you don't update.
  • Removed deprecated data-mjf_ajax_update_id_overwrite attribute.
  • Various bug fixes.

12.11.14

  • magic.12.11.14.zip
  • New $m.storage which allows storing data first in window.localStorage and then document.cookie.
    • Coming sooner or later: window.indexedDB
  • Removed $m.cookies in light of above change. This will break your code if you don't update.
  • Increased default speed for all $m.wand animations.

12.11.12

12.11.6

  • magic.12.11.6.zip
  • Updated Empty Element (via click) to reset the style.opacity to 1 after the element has been emptied.
  • Updated/cleaned up images/icons/.

12.10.30

  • magic.12.10.30.zip
  • Updated everything to work with animation easing functionality added in 12.10.2.
  • Updated Light Switch to work with single checkboxes.
  • Updated documentation design.

12.10.18

  • magic.12.10.18.zip
  • Added an error message for when AJAX requests don't leave a vistor's browser. For example, the AdBlock extension will block all requests to /advertiser links.
  • Fixed the Add Commas bug where an empty value in the field would cause a "false" to appear.
  • Updated Magic Editor trick.

12.10.12

12.10.8

12.10.2

  • magic.12.10.2.zip
  • New animation easing functionality, not in use yet.
  • Magic Debugger work to fix Firefox's NS_ERROR_NOT_AVAILABLE
  • New $m.ut.add_commas(IN_STRING)
  • New Same Height in the Easies section.
  • New Add Commas in the Forms section.
  • Updated $m.h.animations.opaque.set() to use IE's built in style.filter for versions 8 and below.
  • Updated Copying Fields from One to Another with the data-mjf_cf_only_empty="true" attribute. This allows the copy to only happen if the field is empty.
  • Updated Light Switch with collapse/expand all functionality.

12.9.18

  • magic.12.9.18.zip
  • Added the Quick Jump ↵ link to all documenation pages.
  • Added an optional data-mjf_asl_name_value="NAME=VALUE" to AJAX Form Submission (via click).
  • Updated AJAX Form Submission (via click) documentation to correctly state that the data-mjf_asl_action="" attribute is optional.
  • Fixed JSON return bug where the <input> value wasn't always being updated correctly.
  • Fixed the $m.h.form_required.valid_forms[] bug.
  • HTML5 Video scriptable Play option now delays for a second before actually playing. This gives the FLV player a second to initialize if it hasn't already.
  • Minor update to the Magic Calendar.

12.8.24

  • magic.12.8.24.zip
  • New $m.tag.html(IN_ID, IN_CONTENT, IN_HOW, IN_ENCODED) to allow for easier and consisent HTML updates.
  • New $m.de.throw_fatal(IN_MSG) to send errors both to the console and the Magic Debugger.
  • Better error handling.

12.8.20

12.8.7

12.8.6

  • magic.12.8.6.zip
  • New and replacement icons.
  • More reliable Predefined JSON parsing.
  • $m.stop_bubble() will now add a message to the Magic Debugger if there isn't an event to stop.
  • $m.attr.set() can now take a collection of elements as its first argument instead of only one.
    In a future revision similar methods — $m.css_class.add() — will be able to, also.

12.7.31

  • magic.12.7.31.zip
  • Added $m.ajax.update_queue() to easily update the AJAX queue from other functions.
  • If $m.config.ajax.use === false, the browser will now throw a JavaScript error.
  • Form field values are now retained when append/prepending content with AJAX.
  • Converting Fields to URL Friendly Fields now removes single quotes before the conversion.

12.7.20

  • magic.12.7.20.zip
  • For Tool Tips you must now manually add a CSS class tool_tip_cont to the tag that tool tip itself. This will keep the tip from appearing momentarily as the page loads. This will also break your code if you don't update!
  • Fixed a bug in the Checked Picker where the groups weren't created properly during AJAX requests.
  • Added the $m.document property which holds either the current document or the $m.ajax.request.update_id. This is useful for initializing elements after AJAX requests.
  • New Predefined JSON parsing in the AJAX section.

12.7.7

  • magic.12.7.7.zip
  • New Alerting the visitor when navigating away from a changed form in the Forms section.
  • New CSS Class Update in the Easies section.
  • New Empty Element (via click) in the Easies section.
  • New Remove Element (via click) in the Easies section.
  • Added CSS3 transitions to AJAX requests. Change the look by updating .ajax_visual_content in the magic.12.7.7.css.
  • New data-mjf_ajax_update_id_action="overwrite(OR)append(OR)prepend" attribute for AJAX requests.
  • In light of the above change, data-mjf_ajax_update_id_overwrite has been deprecated and will be removed in a future version.
  • Added JavaScript support to control the HTML5 Video player.
  • Temporarily removed the data-mjf_h5v_autoload="true" and data-mjf_h5v_autoplay="true" attributes from HTML5 Video.
  • More documentation clean up.

12.5.30

12.5.22

12.4.19

  • magic.12.4.19.zip
  • Added data-mjf_err_parent="PARENT_ID" to Form Validation to allow highlighting of a particular HTML element on error.
  • Added a stack trace to the Magic Debugger.

12.4.3

  • magic.12.4.3.zip
  • Added config options for Dynamic Tabs with options to autostart the rotation, etc. This won't break existing implementations.
  • Added a millisecond delay before executing callbacks when dynamically inserting <script> tags.
  • Fixed the bug where MSIE wasn't passing the window.event to various methods.

12.3.22

  • magic.12.3.22.zip
  • Removed the auto-magically adding the Dropdown Menu and Dynamic Tabs style sheet to pages. You'll need to do this manually now. Please see its corresponding documentation.
  • Removed config option for css_versions in light of change above. This greatly increases page load and rendering times.
  • Fixed broken Darkroom links on the documentation pages.

12.2.24

12.2.12

12.1.31

  • magic.12.1.31.zip
  • We're now localized!
    • Please see the Introduction tab, Usage section and look for the lang : "en_us" property - this is new.
    • If this isn't set, it will default to en_us.
    • All Tricks will inherit this setting.
    • en_us is the only available language. This, hopefully, will change in the future.
  • The config argument basedir : "/PATH/TO/" passed to $m.construct() can now be used if you'd like to manually set this.
  • Refined the timeout for AJAX calls.
  • Fixed MSIE6 crash when repeatedly refreshing a page.

12.1.28

  • magic.12.1.28.zip
  • AJAX calls will now time out after 5 seconds and a message will be shown to the visitor.
    • This can be overridden on a per element basis by using data-mjf_ajax_timeout="N".
  • Alphabetized the objects in magic.src.js.
  • Added $m.trim(IN_STRING).
  • Changed $m.get_keycode(IN_KEYCODE) to $m.keycode.get(IN_KEYCODE).
  • Changed $m.is_worthy_keycode(IN_KEYCODE) to $m.keycode.is_worthy(IN_KEYCODE).
  • Changed $m.get_mouse_btn(IN_EVENT) to $m.mouse_btn.get(IN_EVENT).
  • Changed $m.ev(IN_STRING) to $m.ev.all(IN_STRING).
  • Changed $m.ev_script(IN_STRING) to $m.ev.script(IN_STRING).
  • Converting Fields to URL Friendly Fields now REALLY strips everything but alphanumeric characters and replaces them with underscores.

12.1.19

12.1.11

  • magic.12.1.11.zip
  • AJAX requests are now queued.
  • AJAX failed requests are now more efficiently caught.
  • Replaced $m.wand.ajax_auto with $m.wand.ajax_polling
  • Converting Fields to URL Friendly Fields now strips single quotes instead of replacing them with underscores.
  • Dropdown Menu improvements. Please review the documentation for proper implementation.
  • Continued documentation cleanup.

12.1.9

  • magic.12.1.9.zip
  • Removed basedir : "/resources/javascript/magic/" from the config argument passed to $m.construct() in light of change below.
  • Added $m.find_baseurl()
    • Magic will now find out where it lives and write its links appropriately.
  • All file version numbers are stored in /PATH/TO/magic/_versions.js for easier documentation and reference.
  • Renamed data-mjf_ajax_click_method to data-mjf_ajax_method.
  • Added special characters to $m.is_worthy_keycode(IN_KEYCODE).

12.1.3

  • magic.12.1.3.zip
  • Replaced $m.wand.ajax_change with $m.wand.ajax_kc
    • This adds the additional onkeyup event handler to the tags and also a three quarter of a second timeout before sending the request.
  • Added $m.is_worthy_keycode(IN_KEYCODE)
    • The worthy keys are: A-Z, 0-9, backspace and delete.
  • If $m.ajax.request.update_id doesn't exist, JavaScript will now throw an error.

11.12.29

  • magic.11.12.29.zip
  • Added two new arguments for $m.smooth_scroll.construct(IN_ID, IN_MINUS_PADDING_TOP, IN_MINUS_PADDING_LEFT)
    • IN_MINUS_PADDING_TOP - moves the scroll up by this integer (in pixels).
    • IN_MINUS_PADDING_LEFT - moves the scroll left by this integer (in pixels).
  • Form Validation uses the above change to pull the page up 20 more pixels than the first error'ed form field.
  • Minor code clean up.

11.12.19

11.11.29

  • Revamped docs!
  • Bug fixes for AJAX Polling.
  • Bug fixes for Checked Picker.
  • Disabled AJAX state checking for now.
  • New config option to set dynamic_tabs.VERSION.css.

11.11.18

  • Version number added to magic_debugger.css
  • New $m.tags.remove
    • Code added for $m.tags.remove.empty.

11.11.11

  • Misc updates for the latest Magic Editor.
  • New $m.tag.clone().
  • New $m.tag.replace().
  • Try/catch for $m.tag.remove().

11.11.1

  • Checked Picker no longer submits the form when pressing Enter / Return and other bug fixes.
  • Removed the incorrectly name trick version of the Checked Picker link. Look at Form Example 5 for documentation.
  • Misc bug fixes and code cleanup.

11.9.27

  • Misc bug fixes and code cleanup.

11.7.1

  • $m.tag.remove() now returns a reference to the removed element.
  • $m.ajax.just_html_update() can now return AJAX responses to <input type="text"> elements.
  • Input On Keyup/Change now works with <input type="text">, <textarea>, and <select> elements.
  • New Checked Picker.

11.4.29

  • Complete code overhaul! This will break your code! Check the "Always Do These" on the Easy Examples tab for how to include the scripts on your page. Also check all the Wand and Tricks that you're using for updated details.
  • Removed setAttribute() and getAttribute() as much as possible.

11.3.25

  • New $m.ajax.active.state and $m.ajax.active.msg to prevent unwanted, multiple requests.
  • $m.stop_bubble() now with more precision.
  • $m.shortcut overhaul.

11.3.15

  • New config option to set dropdown_menu.VERSION.css.
  • Misc CSS updates.
  • Misc code clean up and optimization.

11.2.15

  • Better AJAX return handling.
  • Removed $m.ajax.request_failed().

11.2.14

  • New Text Resizer easy example.
  • New $m.ev_script() for eval'ing JavaScript in a string of HTML.
  • $m.smooth_scroll and $m.smooth_scroll_overflow disabled on Amazon Kindle.
  • Form Submission (via click) bug fixes and form validation.
  • Google Analytics now tracking new _gag style of Analytics code.

11.2.11

  • Dynamic Tabs is now using CSS3 transitions for opacity changing.
  • $m.smooth_scroll has replaced $m.scroll_to_id.
  • $m.smooth_scroll_overflow has replaced $m.scroll_top.

11.2.8

  • New $m.shortcut for easy keyboard shortcut additions.
  • Stable AJAX Polling and documentation.
  • Optimized <script> parsing and executing of AJAX returns.
  • Misc code clean up and optimization.

11.2.1

  • New AJAX Polling functionality – not ready for primetime just yet.
  • Misc code clean up and optimization.

11.1.4

  • New $m.element.attach() for handling addEventListener() and attachEvent().
  • New $m.element.detach() for handling removeEventListener() and detachEvent().
  • New $m.stop_bubble() for stopping event propagation.
  • New $m.try_json_unpack() for handling JSON.parse() errors.
  • New $m.scroll_top() -- sets the element ID scrollTop = 0;
  • New $m.de.get_tricks() -- gets all current loaded tricks.
  • New $m.insert_node_at_selection_point() -- inserts a chunk of HTML into a content editable document (non-MSIE).
  • New data-mjf_ajax_update_id_scroll_to AJAX option -- uses $m.scroll_to_id();.
  • Nintendo Wii and Amazon Kindle browser detection.
  • Darkroom -- v10.12.28

10.12.22

10.12.21

  • AJAX now doesn't bomb for MSIE 6&7.
  • When returning HTML from an AJAX request, only the new HTML is snooped when re-initializing MJS.
  • New data-mjf_ajax_form_reset for $m.wand.ajax_submit.

10.12.20

  • $m.wand.submit_onclick now doesn't bomb when there isn't form validation.
  • $m.wand.submit_onclick now let's you send a name/value pair to the server. This is handy for uniquely identifying their clicks.
  • New data-mjf_ajax_update_id_overwrite AJAX option -- shall we overwrite the update_id content or not?
  • New .ajax_visual_form CSS rule for forms.

10.12.16

  • Renamed the majority of files to include their respective version number. This is for browser caching.
  • Moved the mjf_config out of magic.11.11.29.js and into the HTML files. This is also for caching.

10.12.1

  • Misc code clean up, optimization and bug fixes.

10.10.16

  • Moved various docs around.
  • Darkroom is now its own trick – this will break your code if you don't update!
  • New Form Fields variable name changes – this will break your code if you don't update!
  • New $m.init_tag() for setting up a new tag.
  • Misc code clean up and optimization.

10.10.14

  • Added assist/json2.js for browsers without support.
  • Added iPad detection.

10.10.11

  • dropdown_menu.css and ajax_lookup.css no longer inserted on each AJAX request.
  • $m.strip_tags() now works only on strings.
  • New $m.strip_tags_from_id() for stripping tags from an ID.
  • New $m.ut.decode_entities() for decoding HTML entities in a string.

10.9.28

  • Added time zone detection! Set mjf_config.send_timezone_to to a server side URL and MJS will send you the user's timezone offset.
  • motion.js updates. Not ready for production use.
  • Misc code clean up - no new functionality other than the above.

10.9.24

  • Added IE9 beta support and updated MSIE browser sniffing.
  • $m.wand.s2lcus and $m.wand.copy_fields now working again. Ugh.
  • Style updates in magic.10.12.20 and dropdown_menu.css – better CSS3 support.

10.9.22

  • Updated form validation to validate <select> properly. However, you must have an <option value=""> as your first, empty option.
  • Fixed mjf_config.animations.use quirk.
  • Updated mjf_config.global_debug with false, "low", and "high" options.
  • Added documentation for Simple Image Slideshow.
  • New $m.wand.clear_onclick functionality.
  • One checkbox or radio button no longer screws up form validation.
  • Lots of other bug fixes and code improvements.

10.9.19

10.9.15

  • Updated Google Analytics tracking to better integrate with Google. All hits will now be found in GA's Content > Event Tracking.
  • Removed data-mjf_ga_track_ext and data-mjf_ga_track_ext_cat since they will now be handled automatically.

10.9.7

  • Set default path for cookies to /.
  • Added mjf_config object for Animations. Turned off by default until implemented via CSS3.

10.8.27

  • New $m.wand.change_field_type functionality.

10.8.26

  • Updated $m.wand.copy_fields functionality.

10.8.24

  • More Geolocation code, still no functionality ready.
  • New mjf_config objects for AJAX and Geolocation.
  • Magic Debugger looks and works better.

10.8.23

  • Split the core functionality and the wand items into separate files. This will break your code! Check the "Always Do These" on the Easy Examples tab for how to link to the new $m.wand.js file.
  • Added new $m.wand.copy_fields.
  • For Light Switch
    • Added new data-mjf_lswitch_use_css="false" – this will keep the expanded/collapsed arrows from being added to the trigger.
    • Added new data-mjf_lswitch_cookie="false" – this will keep the individual Light Switch from being stored in a cookie.
  • Added data-mjf_dr_hide="false" to forms inside of a darkroom. This keeps the darkroom open when submitting the form. This is useful if you have a form that submits via AJAX and is inside a darkroom.
  • Initial Geolocation code, no functionality at present.
  • Various bug fixes.

10.8.18

  • Bug fixes.

10.8.17

  • New $m.set_cursor = function(in_id, in_pos) method.
  • New data-mjf_ajax_update_id_scroll_top attribute which scrolls window to the top of the data-mjf_ajax_update_id after a successful AJAX request.
  • New timer to monitor MJS loading time. Turning on debugging to see.

10.8.13

  • Replaced data-m="WHATEVER" with data-mjf="WHATEVER". This will break your code!
  • Replaced all data-(!mjf)="WHATEVER" with data-(mjf_*)="WHATEVER". This will break your code!
  • New data-mjf="|return_false" added to control the final return value. This will break your code - see Notes section on the first tab.
  • Many bug fixes.

10.7.30

  • New $m.remove_tag().
  • New new_form_fields.js – see Other Tricks tab.

10.7.28

  • trick and wand are no longer globals.
  • Blurring all <a> tags if links aren't followed.
  • Even better mobile device recognition.

10.7.27

  • Better mobile device recognition.

10.7.23

10.7.16

10.7.14

  • Fixed Darkroom close image style display for MSIE6 & 7.

10.7.8

10.7.6

  • Fixed document.all[in_id].attributes[in_attribute].value error for MSIE7 and lower.
  • Consolidated MSIE7 and lower checks.
  • Fixed GA tracking # bug.

10.7.5

  • Fixed setTimeout() error.

10.7.2

  • Added Google Analytics Click Track so you can track any <a href="/page.html"> or <a href="http://www.domain.com/page.html"> click.
  • Added Google Analytics tracking for Open New Win.
  • Removed old animations that weren't being used. Will move to CSS based transitions soon.

10.7.1

  • Updated Light Switch; breaks previous versions – update your code.
  • More Darkroom fixes for the new overlay functionality.
  • Removed WebKit script load check, hadn't used it in awhile anyway.

10.6.25

  • Ensured Darkroom overlay resizes when window resizes.
  • Reverted to original throbber.gif.

10.6.22

  • Ensured HTML is added to the document before the JavaScript is executed.
  • Updated CSS style .ajax_visual.
  • New throbber.gif.
  • New overlay option for Darkroom.

10.6.19

  • CSS style .ajax_visual now added/removed on AJAX requests, can be turned off in global var config = { }.
  • Added data-mjf_ga_track="false" option to Darkroom, Dynamic Tabs and all AJAX requests if they needn't be tracked by Google Analytics.

10.6.18

10.6.16

  • Added Google Analytics tracking for Darkroom, Dynamic Tabs and all AJAX requests.
  • Started tracking version changes. :)
A loose list of what needs done

magic.src.js

• Build

  • Better small-screen support for documentation.
  • A pages.css file that any trick, etc. can inherit from for a default look and feel.
  • Unit testing framework.

• Document

  • Internal Magic methods and properties.

• Rewrite

  • $m.de.construct() and fix Magic Debugger's NS_ERROR_NOT_AVAILABLE thrown by this.new_document.close() when using Firefox.
  • top_msg for AJAX and other errors.
  • Various pieces to optimize for browser features.
  • Don't put id into arrays when they're actually href - see Dynamic Tabs.

wand.src.js

• Build

• Fix

• Rewrite

  • Checked Picker to make form validation easier and add touch-based browser support.
  • Text Resizer to include option not to remember text size.

• Investigate

more_form_magic.src.js

  • Review/update code.
  • Event handler to hide the pseudo drop down.
  • Write documentation.

ajax_lookup.src.js

Under heavy development - not for production use.

  • Review/update code.
  • Write documentation.

sortable_tables.src.js

  • Review/update code.
  • Write documentation.
API
  • Currently there isn't documentation to utilize the internal properties and methods of the global $m object.
  • Currently there isn't documentation on writing your own Tricks.
  • These will become a higher priority in the future.
  • However, the code in the *.src.js files is fairly clean and should be easy to comprehend.
Use at your own risk!