+ var _defered_custom = new Array();
+ var _initialized = false;
+ var _animations_running = false;
+
+ //Utility functions
+
+
+
+ function push_following(t, i, v) {
+ if ((typeof t[i]) == 'undefined') {
+ t[i] = new Array();
+ };
+ var l = t[i].length;
+ if (l == 0 || !($.contains(t[i][l-1].get()[0], v.get()[0]))) {
+ t[i][l] = v;
+ };
+ };
+
+ function push(t, i, v) {
+ if ((typeof t[i]) == 'undefined') {
+ t[i] = new Array();
+ };
+ var l = t[i].length;
+ t[i][l] = v;
+ };
+
+
+ function init_canvas(canvas) {
+ var cur_frame = 0;
+ var last_frame = canvas.find(".sws-pause").length;
+ //Add all regular elements to the frame list
+ canvas.find("*").each(function(i) {
+ if ($(this).filter('*[class*="sws-onslide-"]').length) {
+ } else {
+ if ($(this).hasClass("sws-pause")) cur_frame++;
+ var o = {};
+ for (var j = cur_frame; j <= last_frame; j++)
+ o[ "f" + j ] = true;
+ $(this).data("sws-frame-set", o);
+ };
+ });
+
+ canvas.data("sws-frame-info", { current: 0,
+ last: last_frame,
+ custom: new Array() });
+
+ };
+
+
+ //Public methods
+ self.setTemplate = function (tn, fn) { templates[tn] = fn; };
+
+ self.getNumSlides = function () { return _total_slides; };
+
+
+ self.registerCustom = function (i, f) {
+ if (_initialized) return;
+ //jQuery does not seem to work well
+ //on partal doms
+
+ var scripts = document.getElementsByTagName("script");
+ var current = scripts[scripts.length-1];
+
+ var slide = $(current).parents(".sws-slide");
+ if (slide.length == 0) {
+ console.log("no parent ?");
+ return;
+ }
+ _defered_custom[_defered_custom.length] = { src: slide[0],
+ fn: f,
+ frame: i };
+ $(current).remove();
+
+ };