This is an answer to How to bind jQuery History state dynamically in .click()?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var%20e=document.createElement('script');e.setAttribute('language','javascript');e.setAttribute('src','http://gist.github.com/raw/511491/b4f033402d200486aceab558c819a91f615856b3/danwiersema-ajaxy.js');document.body.appendChild(e);void(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gist documents the ways you can include scripts and styles into your page using ajaxy. | |
But the most recommended way is to include all your scripts and styles in your initial pages header. You get a big initial load, but all future loads are quick and fast. | |
The other ways are documented below with the apricots-body and apricots-head examples. The apricots-body would then be the second recommended, and the apricots-head example is not recommended. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: HeadLink.php | |
=================================================================== | |
--- HeadLink.php (revision 22367) | |
+++ HeadLink.php (working copy) | |
@@ -40,7 +40,7 @@ | |
* | |
* @var array | |
*/ | |
- protected $_itemKeys = array('charset', 'href', 'hreflang', 'media', 'rel', 'rev', 'type', 'title', 'extras'); | |
+ protected $_itemKeys = array('id', 'charset', 'href', 'hreflang', 'media', 'rel', 'rev', 'type', 'title', 'extras'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Option 1 - Good solution, can create a controller from this | |
$('.ajaxy-page').ajaxify({ | |
controller: 'page', | |
request: function(){ | |
$('#content').fadeOut(); | |
}, | |
response: function(){ | |
$('#content').html(this.Response.data.content).fadeIn(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Demo of proposed registerPlugin function | |
*/ | |
(function(window,undefined){ | |
// Extract | |
var GENETICS = window.GENTICS, | |
jQuery = window.jQuery; | |
// Prototypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bind and Trigger custom and native events in Prototype | |
* @author Juriy Zaytsev (kangax) | |
* @author Benjamin Lupton (balupton) | |
* @copyright MIT license | |
**/ | |
(function(){ | |
var eventMatchers = { | |
'HTMLEvents': /^(?:load|unload|abort|error|select|hashchange|popstate|change|submit|reset|focus|blur|resize|scroll)$/, |