vendor/assets/javascripts/semantic-ui/modules/behavior/api.js in semantic-ui-rails-0.0.2.1 vs vendor/assets/javascripts/semantic-ui/modules/behavior/api.js in semantic-ui-rails-0.1.0
- old
+ new
@@ -1,45 +1,16 @@
- /* ******************************
- API
- Author: Jack Lukic
- Notes: First Commit May 08, 2012
+/*
+ * # Semantic - API
+ * http://github.com/jlukic/semantic-ui/
+ *
+ *
+ * Copyright 2013 Contributors
+ * Released under the MIT license
+ * http://opensource.org/licenses/MIT
+ *
+ */
- These are modules which bind API functionality to the DOM
-
- Requires: nada
-
- Initialization:
- $('.button')
- .apiButton({
- success: function() {}
- })
- ;
-
- in our example api is automapped to an object literal
- @ quirky.config.endpoint.api
-
- HTML:
- <div class="button" action="follow" data-id="5">
-
- URL : quirky.config.endpoint.api.follow
- Given Value: /follow/{$id}/
- Sent Value : /follow/5/
-
- (4 ways to map api endpoint, each will be looked for in succession)
- url mapping order:
- first : defined in plugin init as url (arbitrary url)
- second : defined in plugin init as action (action in obj literal grouping 'api')
- third : defined in data-url
- fourth : defined in data-action
-
- beforeSend:
- this callback can be used to modify request settings before XHR
- it also can be used to look for for pre-conditions to prevent API
- call by returning "false"
-
-****************************** */
-
;(function ( $, window, document, undefined ) {
$.api = $.fn.api = function(parameters) {
var
@@ -408,28 +379,28 @@
if(settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
- module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.debug.apply(console, arguments);
}
}
},
verbose: function() {
if(settings.verbose && settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
- module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
module.verbose.apply(console, arguments);
}
}
},
error: function() {
- module.error = Function.prototype.bind.call(console.error, console, settings.moduleName + ':');
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
module.error.apply(console, arguments);
},
performance: {
log: function(message) {
var
@@ -452,15 +423,15 @@
clearTimeout(module.performance.timer);
module.performance.timer = setTimeout(module.performance.display, 100);
},
display: function() {
var
- title = settings.moduleName + ':',
+ title = settings.name + ':',
totalTime = 0
;
- clearTimeout(module.performance.timer);
time = false;
+ clearTimeout(module.performance.timer);
$.each(performance, function(index, data) {
totalTime += data['Execution Time'];
});
title += ' ' + totalTime + 'ms';
if(moduleSelector) {
@@ -593,10 +564,11 @@
;
return this;
};
$.api.settings = {
- name : 'API',
+
+ name : 'API',
namespace : 'api',
debug : true,
verbose : true,
performance : true,
\ No newline at end of file