require.config({ baseUrl: "/assets/js", paths: { jquery: "jquery-1.10.2.min", bootstrap: "bootstrap.min", }, shim: { bootstrap: ["jquery"], }, waitSeconds: 0, }); stogram = function () { var self = this; self.plugins = {}; self.init = function (container) { $("[data-selected]").each(function (idx) { var v = $(this).data("selected"); $("option", this).each(function () { if ($(this).val() == v) { $(this).prop("selected", 1); } }); }); require(["bootstrap"], function () { $('[data-toggle="tooltip"]').tooltip(); $('[data-spy="affix"]').affix(); }); $("[data-plugin]", container).each(function (idx) { var plugin = $(this).attr("data-plugin"); var opts = $(this).data(); opts.el = $(this); opts.id = "st-plugin-" + plugin + "-" + idx; self.plugin(plugin, opts); }); }; self.plugin = function (name, opts, callback) { var fa = name.match(/\-(\w)/g); var plugin = {}; if (fa) { for (var x in fa) { func = name .replace(fa[x], fa[x].toUpperCase()) .replace("-", ""); } } var func = eval("self." + func); if (func) { func(el, opts); } else { require(["stogram/plugins/" + name], function ( plugin ) { plugin = new plugin(opts); if (callback) { callback(plugin); } self.plugins[name] = plugin; }); } }; self.init("body"); return self; }; var stogram = new stogram(); window.stogram = stogram;