Skip to content

Instantly share code, notes, and snippets.

@devyfriend
Created December 14, 2012 08:56
Show Gist options
  • Save devyfriend/4283800 to your computer and use it in GitHub Desktop.
Save devyfriend/4283800 to your computer and use it in GitHub Desktop.
/*
example require.js setup file
*/
var G5 = window.G5 || {
photo_editor: false
};
require.config({
baseUrl: base_url,
paths: {
jquery: 'libs/jquery/jquery',
jqueryui: 'libs/jquery/jquery-ui',
carousel: 'libs/photo_editor/plugin/carousel',
blocker: 'libs/photo_editor/plugin/jquery.blockUI',
underscore: 'libs/lodash/lodash',
backbone: 'libs/backbone/backbone',
},
shim: {
jquery: { exports:"$" },
jqueryui: { deps:["jquery"],exports:"$" },
carousel: { deps:["jquery","jqueryui"], exports:"$" },
blocker: { deps:["jquery"], exports:"$" }
}
});
require([
'jquery','underscore','backbone','libs/router','libs/photo_editor/photo_editor'
], function($,_,Backbone,router,photo_editor) {
_.templateSettings = {
interpolate : /\{\{([\s\S]+?)\}\}/g
};
Backbone.history.start({pushState:true,root:'/'});
/*
$(document).on('click', 'a', function (evt) {
var href = $(this).attr('href');
if(href == undefined) return;
var protocol = this.protocol + '//';
if (href.slice(protocol.length) !== protocol) {
evt.preventDefault();
router.navigate(href, true);
}
});
or this
$(document).on("click", "a,button", function(event){
nofollow = $(event.currentTarget).hasClass('nofollow');
if(nofollow) event.preventDefault();
if (!event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) event.preventDefault();
//
href = $(event.currentTarget).attr('href');
url = href.replace('\#\/','').replace('\#\!\/','');
Backbone.history.navigate(url, { trigger: true });
return false
});
*/
// all set .. lets go
G5.photo_editor = photo_editor;
G5.photo_editor.initialize();
console.log('ok');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment