From a9339a07f428b848be508db4d6fcdb262f753485 Mon Sep 17 00:00:00 2001 From: Ethan Welborn Date: Tue, 1 Apr 2014 14:37:48 -0600 Subject: [PATCH 01/21] updates --- guide.js | 192 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 141 insertions(+), 51 deletions(-) diff --git a/guide.js b/guide.js index 06f2fee..0830d6e 100644 --- a/guide.js +++ b/guide.js @@ -1,9 +1,59 @@ (function ( $ ) { + + overlay = function() { + this.construct = function(element) { + this.guide = null; + this.classes = []; + this.queued = []; + this.nonqueued = []; + this.blurb = ''; + this.count = 0; + }; + this.init = function(element) { + this.construct(); + var help = this; + this.guide = element.guide(); + $.each(element.find('[data-blurb]'), function() { + if ($.inArray($(this).attr('class'), help.classes) === -1) { + help.classes.push($(this).attr('class')); + if ($(this).attr('data-order')) { + var index = parseInt($(this).attr('data-order')); + if (help.queued[index] != null) { + help.queued.splice(index+1,0, $(this)); + } + else { + help.queued[index] = $(this); + } + } + else { + help.nonqueued.push($(this)); + } + } + }); + $.each(help.queued, function(i, e) { + if (e) { + help.blurb = $(this).attr('data-blurb'); + $(this).addClass('blurbnum-'+help.count); + help.guide.addStep('.blurbnum-'+help.count, help.blurb, { direction: $(this).attr('data-direction') || 'bottom', margin: $(this).attr('data-margin') || 10 }); + help.count++; + } + }); + $.each(help.nonqueued, function() { + help.blurb = $(this).attr('data-blurb'); + $(this).addClass('blurbnum-'+help.count); + help.guide.addStep('.blurbnum-'+help.count, help.blurb, { direction: $(this).attr('data-direction') || 'bottom', margin: $(this).attr('data-margin') || 10 }); + help.count++; + }); + }; + + return this; +}; var guide = function() { var container, defaults = { - margin: 10 + margin: 10, + direction: 'bottom' }, topMask = $("
").addClass("guideMask"), bottomMask = $("
").addClass("guideMask"), @@ -16,7 +66,20 @@ prevButton = $("