Sidekick - Version 1.5.0

Version Description

  • Paid vs Free Walkthrough Seperation
  • Clean Up of Logs
Download this release

Release Info

Developer raptor235
Plugin Icon 128x128 Sidekick
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4 to 1.5.0

css/sidekick_wordpress.css CHANGED
@@ -256,7 +256,8 @@ div#sidekick.paused div#sk_taskbar button.sk_toggle {
256
  div#sidekick.playing div#sk_taskbar div.sk_toggles,
257
  div#sidekick.paused div#sk_taskbar div.sk_toggles {
258
  display: block;
259
- margin-top: 100px;
 
260
  transform: translate3d(0, 0, 0);
261
  -webkit-transition: all 0.3s ease-out;
262
  -moz-transition: all 0.3s ease-out;
@@ -390,6 +391,10 @@ div#sidekick div#sk_taskbar div.sk_powered_by {
390
  font-size: 12px;
391
  padding: 12px;
392
  }
 
 
 
 
393
  div#sidekick div#sk_taskbar div#logo {
394
  float: left;
395
  height: 100%;
@@ -601,9 +606,9 @@ div#sidekick div#sk_taskbar div.sk_toggles button#toggle_composer:hover {
601
  /*transition: width 0.3s ease-out, max-height 0.3s ease-out, background-color 0.3s ease-out, transform 0.3s ease-out;*/
602
  }
603
  div#sidekick div#sk_taskbar div.sk_toggles button#toggle_hotspots {
604
- display: none;
605
- visibility: hidden;
606
- width: 1px;
607
  border-left: solid 1px white;
608
  background: #f1631d url('../images/sprides_v13.png?v=1.3.4') 10px -248px;
609
  padding-left: 24px;
@@ -799,15 +804,29 @@ div#sidekick #sk_drawer ul.sk_bucketContainer ul li {
799
  padding: 0px;
800
  }
801
  div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade {
802
- bottom: -200px;
803
  position: fixed;
804
  text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
  -webkit-transition: all 0.5s ease-out;
806
  -moz-transition: all 0.5s ease-out;
807
  -o-transition: all 0.5s ease-out;
808
  transition: all 0.5s ease-out;
809
- }
810
- div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li {
811
  background-color: #dddddd;
812
  border-bottom: solid 1px #cbcbcb;
813
  border-top: solid 1px #fff;
@@ -820,6 +839,13 @@ div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li {
820
  div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li button {
821
  margin: 20px;
822
  }
 
 
 
 
 
 
 
823
  div#sidekick #sk_drawer ul.sk_bucketContainer input[type="button"],
824
  div#sidekick #sk_drawer ul.sk_bucketContainer input[type="submit"],
825
  div#sidekick #sk_drawer ul.sk_bucketContainer button {
256
  div#sidekick.playing div#sk_taskbar div.sk_toggles,
257
  div#sidekick.paused div#sk_taskbar div.sk_toggles {
258
  display: block;
259
+ /*margin-top: 100px;*/
260
+ width: 1px;
261
  transform: translate3d(0, 0, 0);
262
  -webkit-transition: all 0.3s ease-out;
263
  -moz-transition: all 0.3s ease-out;
391
  font-size: 12px;
392
  padding: 12px;
393
  }
394
+ div#sidekick div#sk_taskbar div.sk_powered_by a {
395
+ color: white;
396
+ text-decoration: none;
397
+ }
398
  div#sidekick div#sk_taskbar div#logo {
399
  float: left;
400
  height: 100%;
606
  /*transition: width 0.3s ease-out, max-height 0.3s ease-out, background-color 0.3s ease-out, transform 0.3s ease-out;*/
607
  }
608
  div#sidekick div#sk_taskbar div.sk_toggles button#toggle_hotspots {
609
+ /*display: none;*/
610
+ /*visibility: hidden;*/
611
+ /*width: 1px; */
612
  border-left: solid 1px white;
613
  background: #f1631d url('../images/sprides_v13.png?v=1.3.4') 10px -248px;
614
  padding-left: 24px;
804
  padding: 0px;
805
  }
806
  div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade {
 
807
  position: fixed;
808
  text-align: center;
809
+ bottom: -300px;
810
+ }
811
+ div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade .sk_turn_off_composer_upgrade {
812
+ background: url('../images/sprides_v13.png?v=1.3.4') -8px -656px no-repeat;
813
+ border: none;
814
+ position: absolute;
815
+ top: 5px;
816
+ right: 5px;
817
+ color: white;
818
+ margin: 0px;
819
+ border-radius: 10px;
820
+ padding: 2px;
821
+ width: 20px;
822
+ height: 20px;
823
+ font-weight: bold;
824
+ }
825
+ div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li {
826
  -webkit-transition: all 0.5s ease-out;
827
  -moz-transition: all 0.5s ease-out;
828
  -o-transition: all 0.5s ease-out;
829
  transition: all 0.5s ease-out;
 
 
830
  background-color: #dddddd;
831
  border-bottom: solid 1px #cbcbcb;
832
  border-top: solid 1px #fff;
839
  div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li button {
840
  margin: 20px;
841
  }
842
+ div#sidekick #sk_drawer ul.sk_bucketContainer ul#sk_upgrade li button.upgrade_composer {
843
+ background: none;
844
+ color: gray;
845
+ border: none;
846
+ text-decoration: underline;
847
+ margin: 5px;
848
+ }
849
  div#sidekick #sk_drawer ul.sk_bucketContainer input[type="button"],
850
  div#sidekick #sk_drawer ul.sk_bucketContainer input[type="submit"],
851
  div#sidekick #sk_drawer ul.sk_bucketContainer button {
css/sidekick_wpe.css CHANGED
@@ -233,6 +233,8 @@ body div#sidekick div#sk_taskbar div.sk_toggles #toggle_preferences {
233
  }
234
  body div#sidekick div#sk_taskbar div.sk_toggles #toggle_hotspots {
235
  display: none;
 
 
236
  }
237
  body div#sidekick div#sk_taskbar div.sk_toggles button#toggle_hotspots,
238
  body div#sidekick div#sk_taskbar div.sk_toggles button#toggle_drawer {
233
  }
234
  body div#sidekick div#sk_taskbar div.sk_toggles #toggle_hotspots {
235
  display: none;
236
+ visibility: hidden;
237
+ width: 1px;
238
  }
239
  body div#sidekick div#sk_taskbar div.sk_toggles button#toggle_hotspots,
240
  body div#sidekick div#sk_taskbar div.sk_toggles button#toggle_drawer {
js/sk.source.js DELETED
@@ -1,4025 +0,0 @@
1
- /*! sidekick - v1.4 - 2014-07-21 */(function(jQuery, window){
2
-
3
- jQuery.fn.center = function () {
4
- this.css("position","absolute");
5
- this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2) +
6
- jQuery(window).scrollTop()) + "px");
7
- this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2) +
8
- jQuery(window).scrollLeft()) + "px");
9
- return this;
10
- }
11
-
12
- })(jQuery, window);;// http://stackoverflow.com/questions/1225102/jquery-event-to-trigger-action-when-a-div-is-made-visible
13
-
14
- (function ($, document, undefined) {
15
-
16
-
17
-
18
- var _oldShow = $.fn.show;
19
-
20
- $.fn.show = function(speed, oldCallback) {
21
- return $(this).each(function() {
22
- var obj = $(this),
23
- newCallback = function() {
24
- if ($.isFunction(oldCallback)) {
25
- oldCallback.apply(obj);
26
- }
27
- obj.trigger('afterShow');
28
- };
29
-
30
- // you can trigger a before show if you want
31
- obj.trigger('beforeShow');
32
-
33
- // now use the old function to show the element passing the new callback
34
- _oldShow.apply(obj, [speed, newCallback]);
35
- });
36
- };
37
-
38
- })(jQuery, document);;/**
39
-
40
- * timing.jquery.js
41
- *
42
- * JavaScript functions for waiting / repeating / stopping jQuery actions.
43
- *
44
- * This code is published under the MIT License (MIT).
45
- * http://www.opensource.org/licenses/mit-license.php
46
- *
47
- * For examples, reference, and other information see
48
- * http://creativecouple.github.com/jquery-timing/
49
- *
50
- * @author CreativeCouple
51
- * @author Peter Liske
52
- * @copyright (c) 2011 by CreativeCouple
53
- * @see http://creativecouple.github.com/jquery-timing/
54
- */
55
-
56
- (function(jQuery, window){
57
- /**
58
- * object to store statically invoked threads
59
- */
60
- var THREAD_GROUPS = {},
61
-
62
- /**
63
- * unique timing identifier for different purposes
64
- */
65
- tuid = 1,
66
-
67
- /**
68
- * remember original core function $.each()
69
- */
70
- originalEach = jQuery.fn.each,
71
-
72
- /**
73
- * remember original core function $.on() (or $.bind())
74
- */
75
- originalOn = jQuery.fn.on || jQuery.fn.bind,
76
-
77
- /**
78
- * remember original core function $.off() (or $.unbind())
79
- */
80
- originalOff = jQuery.fn.off || jQuery.fn.unbind,
81
-
82
- /**
83
- * .until() and .all() have special meanings
84
- */
85
- loopEndMethods = {};
86
-
87
- function sameOrNextJQuery(before, after) {
88
- after = jQuery(after);
89
- after.prevObject = before;
90
- var i = before.length;
91
- if (i !== after.length) {
92
- return after;
93
- }
94
- while (i--) {
95
- if (before[i] !== after[i]) {
96
- return after;
97
- }
98
- }
99
- return before;
100
- }
101
-
102
- function loopCounts(loops) {
103
- var ret = [], i = loops.length;
104
- while (i--) {
105
- ret[i] = loops[i]._count;
106
- }
107
- return ret;
108
- }
109
-
110
- /**
111
- * Initialize a new timed invocation chain.
112
- *
113
- * @author CreativeCouple
114
- * @author Peter Liske
115
- *
116
- * @param context initial context
117
- * @param methodStack linked list of methods that has been or will be filled by someone else
118
- * @param ongoingLoops optional arguments for callback parameters
119
- * @param onStepCallback function to call on each step
120
- * @returns the timed invocation chain method
121
- */
122
- function createTimedInvocationChain(context, methodStack, ongoingLoops, onStepCallback) {
123
- ongoingLoops = ongoingLoops || [];
124
- var executionState = {
125
- _context: context,
126
- _method: methodStack
127
- },
128
- preventRecursion = false,
129
- method, otherExecutionState, deferred;
130
-
131
- function hookupToProxy(state, mockup){
132
- state._canContinue = false;
133
- function fire(){
134
- state._next = sameOrNextJQuery(state._context, state._next);
135
- state._canContinue = true;
136
- timedInvocationChain();
137
- }
138
- return typeof mockup.promise == "function" ? mockup.promise().then(fire) : mockup.then(fire, true);
139
- }
140
-
141
- /**
142
- * Invoke all the methods currently in the timed invocation chain.
143
- *
144
- * @author CreativeCouple
145
- * @author Peter Liske
146
- */
147
- function timedInvocationChain(deferredReturnValue) {
148
- while (!preventRecursion) try {
149
- // keep recursive calls away
150
- preventRecursion = !preventRecursion;
151
- // save current context state
152
- if (typeof onStepCallback == "function") {
153
- onStepCallback(jQuery.makeArray(executionState._next || executionState._context));
154
- }
155
- // leave the chain when waiting for a trigger
156
- if (executionState._canContinue == false) {
157
- break;
158
- }
159
- // check end of chain
160
- if (!executionState._method._name) {
161
- if (deferred && (!ongoingLoops.length || ongoingLoops[0]._allowPromise)) {
162
- // resolve any waiting promise
163
- if (executionState._context && typeof executionState._context.promise == "function") {
164
- executionState._context.promise().then(deferred.resolve);
165
- } else {
166
- deferred.resolveWith(executionState._context);
167
- }
168
- deferred = null;
169
- }
170
- if (!ongoingLoops.length) {
171
- /*
172
- * We've reached the end of our TIC
173
- * and there is nothing left to wait for.
174
- * So we can safely return the original jQuery object
175
- * hence enabling instant invocation.
176
- */
177
- return executionState._context;
178
- }
179
- /*
180
- * Now we have ongoing loops but reached the chain's end.
181
- */
182
- otherExecutionState = ongoingLoops[0]._openEndAction && ongoingLoops[0]._openEndAction(timedInvocationChain, executionState, ongoingLoops);
183
- if (!otherExecutionState) {
184
- // if innermost loop can't help us, just leave the chain
185
- break;
186
- }
187
- executionState = otherExecutionState;
188
- continue;
189
- }
190
- // check if user tries to use a non-existing function call
191
- method = executionState._context && executionState._context[executionState._method._name] || loopEndMethods[executionState._method._name];
192
- if (!method) {
193
- throw 'no such method "'+executionState._method._name+'" on object ('+executionState._context+')';
194
- }
195
- // check whether we came here triggered or not
196
- if (method.timing && !executionState._canContinue) {
197
- // prevent automatic re-trigger in case of loops
198
- executionState._canContinue = false;
199
- // handle timing method
200
- executionState = method.timing(timedInvocationChain, executionState, ongoingLoops, onStepCallback) || executionState;
201
- } else {
202
- if (!method.timing && !executionState._canContinue) {
203
- // prevent automatic re-trigger in case of loops
204
- executionState._next = executionState._context[executionState._method._name].apply(executionState._context, executionState._method._arguments);
205
- if (ongoingLoops.length && executionState._next && executionState._next instanceof PredictingProxy) {
206
- hookupToProxy(executionState, executionState._next);
207
- continue;
208
- }
209
- }
210
- // go to next step
211
- otherExecutionState = {
212
- _context: executionState._next,
213
- _method: executionState._method._next
214
- };
215
- // prevent automatic re-trigger in case of loops
216
- executionState._canContinue = false;
217
- // invoke callback method with given arguments
218
- if (typeof executionState._callback == "function") {
219
- executionState._callback.apply(executionState._context, loopCounts(ongoingLoops));
220
- }
221
- executionState = otherExecutionState;
222
- }
223
- } catch(e) {
224
- /*
225
- * We had a runtime exception.
226
- * In plain JavaScript live the chain would break now.
227
- * So we do, too.
228
- */
229
- preventRecursion = !preventRecursion;
230
- throw e;
231
- } finally {
232
- preventRecursion = !preventRecursion;
233
- }
234
- return deferredReturnValue;
235
- };
236
- if (jQuery.Deferred) {
237
- // add .promise() method to tic
238
- timedInvocationChain.promise = function(type, target){
239
- var ret = (deferred = deferred || jQuery.Deferred()).promise(target);
240
- timedInvocationChain();
241
- return ret;
242
- };
243
- }
244
- return timedInvocationChain;
245
- }
246
-
247
- /**
248
- * Create a placeholder object to collect chained method calls.
249
- *
250
- * @author CreativeCouple
251
- * @author Peter Liske
252
- *
253
- * @param context initial context
254
- * @param methodStack a linked list that this placeholder will fill with call parameters
255
- * @return the placeholder object
256
- */
257
- function PredictingProxy(context, methodStack, onStepCallback) {
258
- this['.methods'] = methodStack;
259
- this['.callback'] = onStepCallback;
260
- this.length = 0;
261
- Array.prototype.push.apply(this, jQuery.makeArray(this._ = context._ = context));
262
-
263
- for (var key in context) {
264
- if (!(key in PredictingProxy.prototype) && typeof context[key] == "function") {
265
- this[key] = extendMockupPrototype(key);
266
- }
267
- }
268
- }
269
-
270
- // enabling jQuery.when(tic);
271
- if (jQuery.Deferred) {
272
- PredictingProxy.prototype.promise = function(type, target) {
273
- if (typeof type == "object") {
274
- target = type;
275
- type = null;
276
- }
277
- return (this['.callback'] && typeof this['.callback'].promise == "function") ? this['.callback'].promise(type, target) : jQuery.Deferred().resolveWith(this).promise(target);
278
- };
279
- }
280
-
281
- /**
282
- * Create and return a new placeholder function on the prototype of PredictingProxy.
283
- */
284
- function extendMockupPrototype(name){
285
- return PredictingProxy.prototype[name] = function(){
286
- this['.methods']._name = name;
287
- this['.methods']._arguments = arguments;
288
- this['.methods'] = this['.methods']._next = {};
289
- return this['.callback'] ? this['.callback'](this, name, arguments) : this;
290
- };
291
- }
292
-
293
-
294
- /**
295
- * Create replacement methods for .bind(), .on(), .one(), .live(), and .delegate()
296
- * that support chaining instead of giving a callback function.
297
- */
298
- jQuery.each(['bind','on','one','live','delegate'], function(index, name){
299
- if (jQuery.fn[name]) {
300
- var original = jQuery.fn[name];
301
- jQuery.fn[name] = function(){
302
- var i, methodStack, placeholder, timedInvocationChain, deferred, context = this;
303
- for(i=0; i<arguments.length; i++) {
304
- if (typeof arguments[i] == "function" || (arguments[i] && typeof arguments[i] == "object") || arguments[i] === false) {
305
- if (arguments[i] !== jQuery) {
306
- // fix for jQuery 1.6 .one() + .unbind()
307
- if (typeof arguments[i] == "function" && jQuery.guid) {
308
- arguments[i].guid = arguments[i].guid || jQuery.guid++;
309
- }
310
- return original.apply(context, arguments);
311
- }
312
- break;
313
- }
314
- }
315
- Array.prototype.splice.call(arguments, i, 1, function(){
316
- timedInvocationChain = createTimedInvocationChain(context.$(this), methodStack, [{
317
- _count: jQuery.extend(Array.prototype.shift.apply(arguments), arguments),
318
- _allowPromise: true
319
- }], function(elements){
320
- placeholder.length = 0;
321
- Array.prototype.push.apply(placeholder, elements);
322
- });
323
- if (deferred) {
324
- timedInvocationChain.promise().then(deferred.resolve);
325
- deferred = null;
326
- }
327
- return timedInvocationChain();
328
- });
329
- function fire(){
330
- return timedInvocationChain ? timedInvocationChain(placeholder) : placeholder;
331
- }
332
- if (jQuery.Deferred) {
333
- fire.promise = function(type, target){
334
- if (typeof type == "object") {
335
- target = type;
336
- type = null;
337
- }
338
- return (timedInvocationChain && !type) ? timedInvocationChain.promise(type, target) : (deferred = deferred || jQuery.Deferred()).promise(target);
339
- };
340
- }
341
- return placeholder = new PredictingProxy(original.apply(context, arguments), methodStack = {}, fire);
342
- };
343
- }
344
- });
345
-
346
- /**
347
- * Create replacement method for .animate() and .load()
348
- * that support chaining if $ is given as callback function.
349
- */
350
- jQuery.each(['animate','load'], function(index, name){
351
- if (jQuery.fn[name]) {
352
- var original = jQuery.fn[name];
353
- jQuery.fn[name] = function(){
354
- while (arguments.length && arguments[arguments.length-1] == null) {
355
- Array.prototype.pop.apply(arguments);
356
- }
357
- if (this.length && arguments.length > 1 && arguments[arguments.length-1] === jQuery) {
358
- var event = '_timing'+tuid++;
359
- arguments[arguments.length-1] = function(){
360
- jQuery(this).trigger(event);
361
- };
362
- return this.each().one(event).all(original.apply(this, arguments));
363
- }
364
- return original.apply(this, arguments);
365
- };
366
- }
367
- });
368
-
369
- /**
370
- * Define new methods .wait(), .repeat(), .join(), .then()
371
- * which will always start a new TIC if invoked outside of a TIC.
372
- */
373
- jQuery.each(['wait','repeat','join','then'], function(index, name){
374
- jQuery.fn[name] = function(){
375
- var methodStack = {},
376
- placeholder = new PredictingProxy(this, methodStack, createTimedInvocationChain(this, methodStack, [], function(elements){
377
- placeholder.length = 0;
378
- Array.prototype.push.apply(placeholder, elements);
379
- }));
380
- return placeholder[name].apply(placeholder, arguments);
381
- };
382
- });
383
-
384
- /**
385
- * Define to wait for joining all animation queues.
386
- *
387
- * @param timedInvocationChain
388
- * @param executionState
389
- */
390
- jQuery.fn.join.timing = function(timedInvocationChain, executionState) {
391
- var queueName,
392
- promising,
393
- waitingElements = executionState._context.length;
394
-
395
- if (typeof executionState._method._arguments[0] == "string") {
396
- queueName = executionState._method._arguments[0];
397
- if (typeof executionState._method._arguments[1] == "function") {
398
- executionState._callback = executionState._method._arguments[1];
399
- } else {
400
- promising = executionState._method._arguments[1];
401
- executionState._callback = executionState._method._arguments[2];
402
- }
403
- } else {
404
- if (typeof executionState._method._arguments[0] == "function") {
405
- executionState._callback = executionState._method._arguments[0];
406
- } else {
407
- promising = executionState._method._arguments[0];
408
- executionState._callback = executionState._method._arguments[1];
409
- }
410
- }
411
-
412
- executionState._next = executionState._context;
413
- executionState._canContinue = !waitingElements;
414
-
415
- // wait for each element to reach the current end of its queue
416
- if (promising) {
417
- executionState._context.promise(queueName == null ? 'fx' : queueName).then(function(){
418
- executionState._canContinue = true;
419
- timedInvocationChain();
420
- });
421
- } else {
422
- executionState._context.queue(queueName == null ? 'fx' : queueName, function(next){
423
- executionState._canContinue = !--waitingElements;
424
- timedInvocationChain();
425
- next();
426
- });
427
- }
428
- };
429
-
430
- /**
431
- * Define to simply run callback method for .then()
432
- *
433
- * @param timedInvocationChain
434
- * @param executionState
435
- */
436
- jQuery.fn.then.timing = function(timedInvocationChain, executionState){
437
- executionState._callback = executionState._method._arguments[0];
438
- executionState._next = executionState._context;
439
- executionState._canContinue = true;
440
- if (executionState._method._arguments[1]) {
441
- Array.prototype.shift.apply(executionState._method._arguments);
442
- }
443
- };
444
-
445
- /**
446
- * Define timeout or binding to wait for.
447
- *
448
- * @param timedInvocationChain
449
- * @param executionState
450
- */
451
- jQuery.fn.wait.timing = function(timedInvocationChain, executionState, ongoingLoops) {
452
- var trigger, event, timeout, context = executionState._context;
453
-
454
- trigger = executionState._method._arguments[0];
455
- executionState._callback = executionState._method._arguments[1];
456
-
457
- function triggerAction() {
458
- originalOff.call(event ? originalOff.call(context, event, triggerAction) : context, 'unwait', unwaitAction);
459
- executionState._canContinue = true;
460
- executionState._next = sameOrNextJQuery(executionState._context, executionState._next);
461
- timedInvocationChain();
462
- }
463
-
464
- function unwaitAction(evt, skipWait){
465
- originalOff.call(event ? originalOff.call(jQuery(this), event, triggerAction) : jQuery(this), 'unwait', unwaitAction);
466
- context = context.not(this);
467
- if (!skipWait) {
468
- executionState._next = executionState._next.not(this);
469
- }
470
- if (!context.length) {
471
- executionState._canContinue = executionState._next.length;
472
- executionState._next = sameOrNextJQuery(executionState._context, executionState._next);
473
- window.clearTimeout(timeout);
474
- executionState = { _context: context };
475
- }
476
- // just update the snapshot info
477
- timedInvocationChain();
478
- }
479
-
480
- originalOn.call(context, 'unwait', unwaitAction);
481
- executionState._next = context;
482
-
483
- if (trigger == null || trigger == jQuery) {
484
- trigger = context;
485
- }
486
- if (typeof trigger == "function") {
487
- trigger = trigger.apply(context, loopCounts(ongoingLoops));
488
- }
489
- if (typeof trigger == "string") {
490
-
491
- originalOn.call(context, event = trigger, triggerAction);
492
-
493
- } else if (trigger && typeof trigger.promise == "function") {
494
-
495
- trigger.promise().then(triggerAction);
496
-
497
- } else if (trigger && typeof trigger.then == "function") {
498
-
499
- trigger.then(triggerAction, true);
500
-
501
- } else {
502
-
503
- timeout = window.setTimeout(triggerAction, Math.max(0,trigger));
504
-
505
- }
506
- };
507
-
508
- /**
509
- * Define to simply run callback method for .then()
510
- *
511
- * @param timedInvocationChain
512
- * @param executionState
513
- */
514
- jQuery.fn.each = function(callback){
515
- if (!callback || callback === jQuery) {
516
- var methodStack = {},
517
- placeholder = new PredictingProxy(this, methodStack, createTimedInvocationChain(this, methodStack, [], function(elements){
518
- placeholder.length = 0;
519
- Array.prototype.push.apply(placeholder, elements);
520
- }));
521
- return placeholder.each(callback);
522
- }
523
- return originalEach.apply(this, arguments);
524
- };
525
-
526
- /**
527
- * Define interval or binding to repeat.
528
- *
529
- * @param timedInvocationChain
530
- * @param executionState
531
- */
532
- jQuery.fn.each.timing = function(timedInvocationChain, executionState, ongoingLoops, onStepCallback) {
533
- if (executionState._method._arguments[0] && executionState._method._arguments[0] !== jQuery) {
534
- executionState._canContinue = true;
535
- executionState._next = originalEach.apply(executionState._context, executionState._method._arguments);
536
- return;
537
- }
538
-
539
- var size = Math.max(executionState._context.length, 1),
540
- finished = 0,
541
- key, methodToGoOn, openLoopTimeout,
542
- innerTICs = [],
543
- innerElements = [],
544
- proxyPlaceholder = jQuery.extend({}, executionState._context),
545
- stepByStep = executionState._method._arguments[0] === jQuery;
546
-
547
- if (stepByStep) {
548
- window.setTimeout(function(){
549
- openLoopTimeout = true;
550
- timedInvocationChain();
551
- },0);
552
- }
553
-
554
- function spreadAction(){
555
- if (stepByStep) {
556
- if (finished < size) {
557
- (innerTICs[finished])();
558
- }
559
- } else {
560
- for (var i=0; i<size; i++) {
561
- (innerTICs[i])();
562
- }
563
- }
564
- return proxyPlaceholder;
565
- }
566
-
567
- for (key in PredictingProxy.prototype) {
568
- proxyPlaceholder[key] = spreadAction;
569
- }
570
- proxyPlaceholder.length = size;
571
- for(key=0; key<size; key++) (function(index){
572
- var innerLoops = ongoingLoops.slice(),
573
- context = executionState._context.eq(index);
574
- innerElements[index] = context.get();
575
- innerLoops.unshift({
576
- _count: index,
577
- _allAction: function(state){
578
- finished++;
579
- if (finished == size) {
580
- methodToGoOn = state._method._next;
581
- }
582
- timedInvocationChain();
583
- },
584
- _fixOpenLoop: loopEndMethods.all,
585
- _openEndAction: function(tic, state){
586
- if (openLoopTimeout) {
587
- finished++;
588
- if (finished == size) {
589
- methodToGoOn = state._method;
590
- }
591
- timedInvocationChain();
592
- }
593
- }
594
- });
595
- innerTICs[index] = createTimedInvocationChain(context, executionState._method._next, innerLoops, function(elements){
596
- innerElements[index] = elements;
597
- proxyPlaceholder.length = 0;
598
- for (var i=0; i<size; i++) {
599
- Array.prototype.push.apply(proxyPlaceholder, innerElements[i]);
600
- }
601
- if (onStepCallback)
602
- onStepCallback(jQuery.makeArray(proxyPlaceholder));
603
- });
604
- })(key);
605
-
606
- executionState._next = proxyPlaceholder;
607
- executionState._canContinue = true;
608
- executionState._openEndAction = function(tic, state){
609
- if (finished == size) {
610
- ongoingLoops.shift();
611
- return {
612
- _context: sameOrNextJQuery(executionState._context, proxyPlaceholder),
613
- _method: methodToGoOn
614
- };
615
- }
616
- var finishedBefore = finished;
617
- spreadAction();
618
- if (finished != finishedBefore) {
619
- return state;
620
- }
621
- };
622
- executionState._count = size;
623
-
624
- ongoingLoops.unshift(executionState);
625
- };
626
-
627
- loopEndMethods.all = function(executionState){
628
- jQuery.extend(executionState._method, {
629
- _next: jQuery.extend({}, executionState._method),
630
- _name: 'all',
631
- _arguments: []
632
- });
633
- executionState._canContinue = null;
634
- };
635
- loopEndMethods.all.timing = function(timedInvocationChain, executionState, ongoingLoops) {
636
- if (!ongoingLoops.length || !ongoingLoops[0]._fixOpenLoop) {
637
- throw '.all() method must be used after .each() only';
638
- }
639
- if (!ongoingLoops[0]._allAction) {
640
- ongoingLoops[0]._fixOpenLoop(executionState);
641
- return;
642
- }
643
-
644
- ongoingLoops[0]._allAction(executionState);
645
- };
646
-
647
- /**
648
- * Define interval or binding to repeat.
649
- *
650
- * @param timedInvocationChain
651
- * @param executionState
652
- */
653
- jQuery.fn.repeat.timing = function(timedInvocationChain, executionState, ongoingLoops) {
654
- var trigger,
655
- firstRunNow,
656
- openLoopTimeout,
657
- event,
658
- interval;
659
-
660
- if (typeof executionState._method._arguments[0] == "function") {
661
- executionState._callback = executionState._method._arguments[0];
662
- } else if (typeof executionState._method._arguments[1] == "function") {
663
- trigger = executionState._method._arguments[0];
664
- executionState._callback = executionState._method._arguments[1];
665
- } else {
666
- trigger = executionState._method._arguments[0];
667
- firstRunNow = executionState._method._arguments[1];
668
- executionState._callback = executionState._method._arguments[2];
669
- }
670
-
671
- function triggerAction() {
672
- executionState._next = executionState._next || executionState._context;
673
- executionState._canContinue = true;
674
- timedInvocationChain();
675
- }
676
-
677
- function unrepeatAction(){
678
- originalOff.call(event ? originalOff.call(jQuery(this), event, triggerAction) : jQuery(this), 'unrepeat', unrepeatAction);
679
- var context = executionState._context.not(this);
680
- executionState._next = (executionState._next == executionState._context) ? context : executionState._next;
681
- executionState._context = context;
682
- executionState._canContinue = executionState._context.length && executionState._canContinue;
683
- trigger = executionState._context.length && trigger;
684
- window.clearInterval(!executionState._context.length && interval);
685
- // just update the snapshot info
686
- timedInvocationChain();
687
- }
688
-
689
- executionState._openEndAction = function(tic, state){
690
- if (executionState._canContinue || openLoopTimeout) {
691
- executionState._count++;
692
- executionState._next = executionState._next || executionState._context;
693
- executionState._canContinue = executionState._canContinue || (trigger && state._context && state._context.length);
694
- return executionState;
695
- }
696
- };
697
-
698
- if (trigger == null) {
699
-
700
- firstRunNow = trigger = true;
701
- window.setTimeout(function(){
702
- openLoopTimeout = true;
703
- timedInvocationChain();
704
- },0);
705
-
706
- } else {
707
- if (typeof trigger == "string") {
708
- originalOn.call(executionState._context, event = trigger, triggerAction);
709
- } else {
710
- interval = window.setInterval(triggerAction, Math.max(0, trigger));
711
- }
712
- trigger = false;
713
- }
714
-
715
- originalOn.call(executionState._context, 'unrepeat', unrepeatAction);
716
-
717
- executionState._next = executionState._context;
718
- executionState._count = 0;
719
- executionState._untilAction = function(end){
720
- if (end) {
721
- unrepeatAction.apply(executionState._context);
722
- }
723
- if (trigger) {
724
- triggerAction();
725
- }
726
- };
727
- executionState._fixOpenLoop = loopEndMethods.until;
728
-
729
- if (firstRunNow) {
730
- triggerAction();
731
- }
732
-
733
- ongoingLoops.unshift(executionState);
734
- };
735
-
736
- /**
737
- * Defined to evaluate condition when calling .until()
738
- */
739
- loopEndMethods.until = function(executionState){
740
- jQuery.extend(executionState._method, {
741
- _next: jQuery.extend({}, executionState._method),
742
- _name: 'until',
743
- _arguments: []
744
- });
745
- executionState._canContinue = null;
746
- };
747
- loopEndMethods.until.timing = function(timedInvocationChain, executionState, ongoingLoops) {
748
- if (!ongoingLoops.length || !ongoingLoops[0]._fixOpenLoop) {
749
- throw '.until() method must be used after .repeat() only';
750
- }
751
- if (!ongoingLoops[0]._untilAction) {
752
- ongoingLoops[0]._fixOpenLoop(executionState);
753
- return;
754
- }
755
-
756
- var condition = executionState._method._arguments[0],
757
- loopContext = executionState._method._arguments[1];
758
- if (condition === jQuery) {
759
- condition = null;
760
- loopContext = executionState._method._arguments.length <= 1 || loopContext;
761
- }
762
- if (typeof condition == "function") {
763
- condition = condition.apply(executionState._context, loopCounts(ongoingLoops));
764
- }
765
- if (condition == null) {
766
- condition = !executionState._context.size();
767
- }
768
- if (typeof condition == "object") {
769
- condition = condition.toString();
770
- }
771
- if (typeof condition == "number") {
772
- condition = ongoingLoops[0]._count >= condition-1;
773
- }
774
- if (condition) {
775
- executionState._canContinue = true;
776
- executionState._next = executionState._context;
777
- ongoingLoops.shift()._untilAction(condition);
778
- } else {
779
- if (loopContext) {
780
- ongoingLoops[0]._next = executionState._context;
781
- }
782
- executionState = ongoingLoops[0];
783
- executionState._count++;
784
- executionState._untilAction(condition);
785
- return executionState;
786
- }
787
- };
788
-
789
- // support .until() and .all()
790
- new PredictingProxy(loopEndMethods);
791
-
792
- /**
793
- * Define unwait and unrepeat methods.
794
- */
795
- jQuery.each(['unwait','unrepeat'], function(index, name){
796
- jQuery.fn[name] = function(){
797
- return this.trigger(name, arguments);
798
- };
799
- });
800
-
801
- /**
802
- * define all static timing methods:
803
- * $.wait, $.repeat ,$.join, $.then, $.unwait, $.unrepeat
804
- */
805
- jQuery.each(['wait','repeat','join','then','unwait','unrepeat'], function(index, name){
806
- jQuery[name] = function(){
807
- var group = typeof arguments[0] == "string" ? Array.prototype.shift.apply(arguments) : '';
808
- return jQuery.fn[name].apply(THREAD_GROUPS[group] = (THREAD_GROUPS[group] || jQuery('<div>').text(group)), arguments);
809
- };
810
- });
811
-
812
- /**
813
- * X defines deferred variables that can be used in timed invocation chains
814
- *
815
- * @author CreativeCouple
816
- * @author Peter Liske
817
- */
818
- function X(compute, Var, calculation){
819
- if (typeof compute == "string") {
820
- calculation = new Function('x','return ['+compute+'\n,x]');
821
- compute = function(x, result){
822
- result = calculation(x);
823
- callbackVariable.x = result[1];
824
- return result[0];
825
- };
826
- }
827
- var hasRelatedVariable = typeof Var == "function",
828
- hasComputation = typeof compute == "function",
829
-
830
- callbackVariable = function(value) {
831
- if (arguments.length == 1) {
832
- callbackVariable.x = value;
833
- if (hasRelatedVariable) {
834
- Var(value);
835
- }
836
- } else {
837
- return evaluate();
838
- }
839
- };
840
- function evaluate(value){
841
- value = hasRelatedVariable ? Var() : callbackVariable.x;
842
- return hasComputation ? compute(value) : value;
843
- }
844
-
845
- callbackVariable.x = 0;
846
- callbackVariable._ = { toString: callbackVariable.$ = callbackVariable.toString = evaluate.toString = evaluate };
847
- callbackVariable.mod = function(val){
848
- return X(function(x){
849
- return x % val;
850
- }, callbackVariable);
851
- };
852
- callbackVariable.add = function(val){
853
- return X(function(x){
854
- return x + val;
855
- }, callbackVariable);
856
- };
857
- callbackVariable.neg = function(){
858
- return X('-x', callbackVariable);
859
- };
860
- // $$ only for backward compatibility
861
- callbackVariable.$$ = callbackVariable.X = function(compute){
862
- return X(compute, callbackVariable);
863
- };
864
- jQuery.each('abcdefghij', function(index, character){
865
- callbackVariable[index] = callbackVariable[character] = function(){
866
- callbackVariable(arguments[index]);
867
- };
868
- });
869
-
870
- return callbackVariable;
871
- };
872
-
873
- // $$ only for backward compatibility
874
- window.$$ = jQuery.$$ = jQuery.X = X;
875
-
876
- /**
877
- * Define chained version of $().
878
- * This allows to use .end() to come back to previous jQuery selection.
879
- */
880
- jQuery.fn.$ = function(){
881
- var ret = jQuery.apply(window, arguments);
882
- ret.prevObject = this;
883
- return ret;
884
- };
885
-
886
- })(jQuery, window);;/*!
887
- * jQuery Cookie Plugin v1.4.1
888
- * https://github.com/carhartl/jquery-cookie
889
- *
890
- * Copyright 2013 Klaus Hartl
891
- * Released under the MIT license
892
- */
893
- (function (factory) {
894
- if (typeof define === 'function' && define.amd) {
895
- // AMD
896
- define(['jquery'], factory);
897
- } else if (typeof exports === 'object') {
898
- // CommonJS
899
- factory(require('jquery'));
900
- } else {
901
- // Browser globals
902
- factory(jQuery);
903
- }
904
- }(function ($) {
905
-
906
- var pluses = /\+/g;
907
-
908
- function encode(s) {
909
- return config.raw ? s : encodeURIComponent(s);
910
- }
911
-
912
- function decode(s) {
913
- return config.raw ? s : decodeURIComponent(s);
914
- }
915
-
916
- function stringifyCookieValue(value) {
917
- return encode(config.json ? JSON.stringify(value) : String(value));
918
- }
919
-
920
- function parseCookieValue(s) {
921
- if (s.indexOf('"') === 0) {
922
- // This is a quoted cookie as according to RFC2068, unescape...
923
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
924
- }
925
-
926
- try {
927
- // Replace server-side written pluses with spaces.
928
- // If we can't decode the cookie, ignore it, it's unusable.
929
- // If we can't parse the cookie, ignore it, it's unusable.
930
- s = decodeURIComponent(s.replace(pluses, ' '));
931
- return config.json ? JSON.parse(s) : s;
932
- } catch(e) {}
933
- }
934
-
935
- function read(s, converter) {
936
- var value = config.raw ? s : parseCookieValue(s);
937
- return $.isFunction(converter) ? converter(value) : value;
938
- }
939
-
940
- var config = $.cookie = function (key, value, options) {
941
-
942
- // Write
943
-
944
- if (value !== undefined && !$.isFunction(value)) {
945
- options = $.extend({}, config.defaults, options);
946
-
947
- if (typeof options.expires === 'number') {
948
- var days = options.expires, t = options.expires = new Date();
949
- t.setTime(+t + days * 864e+5);
950
- }
951
-
952
- return (document.cookie = [
953
- encode(key), '=', stringifyCookieValue(value),
954
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
955
- options.path ? '; path=' + options.path : '',
956
- options.domain ? '; domain=' + options.domain : '',
957
- options.secure ? '; secure' : ''
958
- ].join(''));
959
- }
960
-
961
- // Read
962
-
963
- var result = key ? undefined : {};
964
-
965
- // To prevent the for loop in the first place assign an empty array
966
- // in case there are no cookies at all. Also prevents odd result when
967
- // calling $.cookie().
968
- var cookies = document.cookie ? document.cookie.split('; ') : [];
969
-
970
- for (var i = 0, l = cookies.length; i < l; i++) {
971
- var parts = cookies[i].split('=');
972
- var name = decode(parts.shift());
973
- var cookie = parts.join('=');
974
-
975
- if (key && key === name) {
976
- // If second argument (value) is a function it's a converter...
977
- result = read(cookie, value);
978
- break;
979
- }
980
-
981
- // Prevent storing a cookie that we couldn't decode.
982
- if (!key && (cookie = read(cookie)) !== undefined) {
983
- result[name] = cookie;
984
- }
985
- }
986
-
987
- return result;
988
- };
989
-
990
- config.defaults = {};
991
-
992
- $.removeCookie = function (key, options) {
993
- if ($.cookie(key) === undefined) {
994
- return false;
995
- }
996
-
997
- // Must not alter options, thus extending a fresh object...
998
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
999
- return !$.cookie(key);
1000
- };
1001
-
1002
- }));
1003
- ;// Generated by CoffeeScript 1.6.3
1004
- /*
1005
- jQuery css-watch event Coffeescript
1006
- http://github.com/leifcr/jquery-csswatch/
1007
- (c) 2012-2013 Leif Ringstad
1008
-
1009
- @author Leif Ringstad
1010
- @version 1.2.1
1011
- @date 10/27/2013
1012
-
1013
- Licensed under the freeBSD license
1014
- */
1015
-
1016
-
1017
- (function() {
1018
- var ExecuteMethod,
1019
- __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
1020
-
1021
- (function($, window, document) {
1022
- /*
1023
- Plugin constructor
1024
- */
1025
-
1026
- var CssWatch;
1027
- CssWatch = function(elem, options) {
1028
- this.elem = elem;
1029
- this.$elem = $(elem);
1030
- this.options = options;
1031
- this.cb_timer_id = null;
1032
- this.stop_requested = false;
1033
- };
1034
- /*
1035
- Plugin prototype
1036
- */
1037
-
1038
- CssWatch.prototype = {
1039
- defaults: {
1040
- event_name: "css-change",
1041
- data_attr_name: "css-watch-data",
1042
- use_event: true,
1043
- callback: null,
1044
- props: "",
1045
- props_functions: {}
1046
- },
1047
- /*
1048
- Initializer
1049
- */
1050
-
1051
- init: function() {
1052
- this.config = $.extend({}, this.defaults, this.options, this.metadata);
1053
- this.config.props = this.splitAndTrimProps(this.config.props);
1054
- if (this.config.props.length > 0) {
1055
- this.setInitialData();
1056
- this.start();
1057
- }
1058
- return this;
1059
- },
1060
- /*
1061
- split and trim properties
1062
- */
1063
-
1064
- splitAndTrimProps: function(props) {
1065
- var arr, i, ret;
1066
- arr = props.split(",");
1067
- ret = [];
1068
- i = 0;
1069
- while (i < arr.length) {
1070
- ret.push(arr[i].trim());
1071
- i++;
1072
- }
1073
- return ret;
1074
- },
1075
- /*
1076
- set initial data
1077
- */
1078
-
1079
- setInitialData: function() {
1080
- var i;
1081
- i = 0;
1082
- while (i < this.config.props.length) {
1083
- this.setData(this.config.props[i], this.getPropertyValue(this.config.props[i]));
1084
- i++;
1085
- }
1086
- },
1087
- /*
1088
- set a data element for a css property on the current element
1089
- */
1090
-
1091
- setData: function(property, value) {
1092
- return this.$elem.data("" + this.config.data_attr_name + "-" + property, value);
1093
- },
1094
- /*
1095
- update data attributes from changes
1096
- */
1097
-
1098
- updateDataFromChanges: function(changes) {
1099
- var property, value, _i, _len, _ref;
1100
- _ref = Object.keys(changes);
1101
- for (value = _i = 0, _len = _ref.length; _i < _len; value = ++_i) {
1102
- property = _ref[value];
1103
- this.setData(property, changes[property]);
1104
- }
1105
- },
1106
- /*
1107
- get the datavalue stored for a property
1108
- */
1109
-
1110
- getDataValue: function(property) {
1111
- return this.$elem.data("" + this.config.data_attr_name + "-" + property);
1112
- },
1113
- /*
1114
- get css property value (from jquery css or from custom function if needed)
1115
- */
1116
-
1117
- getPropertyValue: function(property) {
1118
- var function_to_call;
1119
- if (Object.keys(this.config.props_functions).length === 0) {
1120
- return this.$elem.css(property);
1121
- }
1122
- function_to_call = null;
1123
- if (__indexOf.call(Object.keys(this.config.props_functions), property) >= 0) {
1124
- function_to_call = this.config.props_functions[property];
1125
- } else {
1126
- function_to_call === null;
1127
- }
1128
- if (function_to_call !== null) {
1129
- if (window.ExecuteMethod) {
1130
- return ExecuteMethod.executeMethodByFunctionName(function_to_call, this.$elem);
1131
- } else {
1132
- console.log("You are missing the ExecuteMethod library.");
1133
- }
1134
- }
1135
- return this.$elem.css(property);
1136
- },
1137
- /*
1138
- get object of changes
1139
- */
1140
-
1141
- changedProperties: function() {
1142
- var i, ret;
1143
- i = 0;
1144
- ret = {};
1145
- while (i < this.config.props.length) {
1146
- if (this.getPropertyValue(this.config.props[i]) !== this.getDataValue(this.config.props[i])) {
1147
- ret[this.config.props[i]] = this.getPropertyValue(this.config.props[i]);
1148
- }
1149
- i++;
1150
- }
1151
- return ret;
1152
- },
1153
- /*
1154
- stop csswatch / checking of css attributes
1155
- */
1156
-
1157
- stop: function() {
1158
- var stop_requested;
1159
- if (typeof this.config === "undefined" || this.config === null) {
1160
- return;
1161
- }
1162
- stop_requested = true;
1163
- return window.cssWatchCancelAnimationFrame(this.cb_timer_id);
1164
- },
1165
- /*
1166
- start csswatch / checking of css attributes
1167
- */
1168
-
1169
- start: function() {
1170
- var _this = this;
1171
- if (typeof this.config === "undefined" || this.config === null) {
1172
- return;
1173
- }
1174
- this.stop_requested = false;
1175
- this.cb_timer_id = window.cssWatchRequestAnimationFrame(function() {
1176
- _this.check();
1177
- });
1178
- },
1179
- /*
1180
- the actual checking of changes
1181
- */
1182
-
1183
- check: function() {
1184
- var changes,
1185
- _this = this;
1186
- if (typeof this.config === "undefined" || this.config === null) {
1187
- return false;
1188
- }
1189
- if (this.stop_requested === true) {
1190
- return false;
1191
- }
1192
- changes = this.changedProperties();
1193
- if (Object.keys(changes).length > 0) {
1194
- if (this.config.use_event) {
1195
- this.$elem.trigger(this.config.event_name, changes);
1196
- }
1197
- if (this.config.callback !== null) {
1198
- this.config.callback.apply(null, [changes]);
1199
- }
1200
- this.updateDataFromChanges(changes);
1201
- }
1202
- this.cb_timer_id = window.cssWatchRequestAnimationFrame(function() {
1203
- _this.check();
1204
- });
1205
- return false;
1206
- },
1207
- /*
1208
- destroy plugin (stop/remove data)
1209
- */
1210
-
1211
- destroy: function() {
1212
- this.stop();
1213
- this.$elem.removeData("css-watch-object");
1214
- this.$elem.removeData(this.config.data_attr_name);
1215
- return null;
1216
- }
1217
- };
1218
- /*
1219
- Set defaults
1220
- */
1221
-
1222
- CssWatch.defaults = CssWatch.prototype.defaults;
1223
- /*
1224
- Jquery extension for plugin
1225
- Plugin funcitonality is in the class above
1226
- */
1227
-
1228
- $.fn.csswatch = function(options) {
1229
- return this.each(function() {
1230
- var data, obj;
1231
- if (typeof options === "object" || !options) {
1232
- data = $(this).data("css-watch-object");
1233
- if (!data) {
1234
- obj = new CssWatch(this, options);
1235
- $(this).data("css-watch-object", obj);
1236
- obj.init();
1237
- }
1238
- } else if (typeof options === "string") {
1239
- obj = $(this).data("css-watch-object");
1240
- if (obj && obj[options]) {
1241
- return obj[options].apply(this);
1242
- }
1243
- }
1244
- });
1245
- };
1246
- })(jQuery, window, document);
1247
-
1248
- /*
1249
- #
1250
- # Cross browser Object.keys implementation
1251
- #
1252
- # This is suggested implementation from Mozilla for supporting browser that do not implement Object.keys
1253
- # if object doesn't have .keys function
1254
- # if(!Object.keys) Object.keys = function(o){
1255
- # if (o !== Object(o))
1256
- # throw new TypeError('Object.keys called on non-object');
1257
- # var ret=[],p;
1258
- # for(p in o) if(Object.prototype.hasOwnProperty.call(o,p)) ret.push(p);
1259
- # return ret;
1260
- # }
1261
- */
1262
-
1263
-
1264
- if (!Object.keys) {
1265
- Object.keys = function(o) {
1266
- var p, ret;
1267
- if (o !== Object(o)) {
1268
- throw new TypeError("Object.keys called on non-object");
1269
- }
1270
- ret = [];
1271
- p = void 0;
1272
- for (p in o) {
1273
- if (Object.prototype.hasOwnProperty.call(o, p)) {
1274
- ret.push(p);
1275
- }
1276
- }
1277
- return ret;
1278
- };
1279
- }
1280
-
1281
- /*
1282
- Cross browser requestAnimationFrame
1283
- Not including settimeout as it will have a static value for timeout
1284
- */
1285
-
1286
-
1287
- if (!window.cssWatchRequestAnimationFrame) {
1288
- window.cssWatchRequestAnimationFrame = (function() {
1289
- return window.webkitAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.requestAnimationFrame || function(callback, element) {
1290
- return window.setTimeout(callback, 1000 / 60);
1291
- };
1292
- })();
1293
- }
1294
-
1295
- /*
1296
- Cross browser cancelAnimationFrame
1297
- */
1298
-
1299
-
1300
- if (!window.cssWatchCancelAnimationFrame) {
1301
- window.cssWatchCancelAnimationFrame = (function() {
1302
- return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || function(timeout_id) {
1303
- return window.clearTimeout(timeout_id);
1304
- };
1305
- })();
1306
- }
1307
-
1308
- /*
1309
- # Execute Method
1310
- # (c) 2012 Leif Ringstad
1311
- # Licensed under the freeBSD license (see LICENSE.txt for details)
1312
- #
1313
- # Source: http://github.com/leifcr/execute_method
1314
- # v 1.0.0
1315
- */
1316
-
1317
-
1318
- ExecuteMethod = {
1319
- getFunctionsAndProperties: function(str) {
1320
- var arr, i, ret;
1321
- arr = str.split(".");
1322
- i = 0;
1323
- ret = [];
1324
- while (i < arr.length) {
1325
- ret.push(ExecuteMethod.getFunctionAndParameters(arr[i]));
1326
- i++;
1327
- }
1328
- return ret;
1329
- },
1330
- getFunctionAndParameters: function(str) {
1331
- var func, isfunc, params;
1332
- if (ExecuteMethod.isFunction(str)) {
1333
- params = str.substring(str.indexOf("(") + 1, str.indexOf(")"));
1334
- if (params.length > 0) {
1335
- params = ExecuteMethod.splitAndTypeCastParameters(params);
1336
- } else {
1337
- params = [];
1338
- }
1339
- func = str.substring(0, str.indexOf("\("));
1340
- isfunc = true;
1341
- } else {
1342
- func = str;
1343
- params = null;
1344
- isfunc = false;
1345
- }
1346
- return {
1347
- func: func,
1348
- params: params,
1349
- isfunc: isfunc
1350
- };
1351
- },
1352
- splitAndTypeCastParameters: function(params) {
1353
- var arr, i, ret;
1354
- arr = params.split(",");
1355
- ret = [];
1356
- i = 0;
1357
- ret = [];
1358
- while (i < arr.length) {
1359
- ret.push(ExecuteMethod.typecastParameter(arr[i]));
1360
- i++;
1361
- }
1362
- return ret;
1363
- },
1364
- isFunction: function(str) {
1365
- if (ExecuteMethod.regexIndexOf(str, /(\([\d|\D]+\))|(\(\))/, 0) !== -1) {
1366
- return true;
1367
- }
1368
- return false;
1369
- },
1370
- regexIndexOf: function(string, regex, startpos) {
1371
- var indexOf;
1372
- indexOf = string.substring(startpos || 0).search(regex);
1373
- if (indexOf >= 0) {
1374
- return indexOf + (startpos || 0);
1375
- } else {
1376
- return indexOf;
1377
- }
1378
- },
1379
- typecastParameter: function(param) {
1380
- param = param.trim();
1381
- param = param.replace(/^"/, "");
1382
- param = param.replace(/"$/m, "");
1383
- if (param.search(/^\d+$/) === 0) {
1384
- return parseInt(param);
1385
- } else if (param.search(/^\d+\.\d+$/) === 0) {
1386
- return parseFloat(param);
1387
- } else if (param === "false") {
1388
- return false;
1389
- } else if (param === "true") {
1390
- return true;
1391
- }
1392
- return param;
1393
- },
1394
- executeSingleFunction: function(func, params, context, _that) {
1395
- return context[func].apply(_that, params);
1396
- },
1397
- getSingleProperty: function(property, context) {
1398
- return context[property];
1399
- },
1400
- /*
1401
- # @param {String} Provide a string on what to execute (e.g. this.is.something(true).to_run() or myFunction().property or myFunction())
1402
- # @param {Object} Provide a object to run the string provided on
1403
- # @param {Object} Provide an object that points to the "this" pointer which
1404
- */
1405
-
1406
- executeMethodByFunctionName: function(str, context) {
1407
- var current_context, current_val, func_data, i;
1408
- func_data = ExecuteMethod.getFunctionsAndProperties(str);
1409
- i = 0;
1410
- current_context = context;
1411
- current_val = null;
1412
- while (i < func_data.length) {
1413
- if (func_data[i]["isfunc"] === true) {
1414
- current_context = ExecuteMethod.executeSingleFunction(func_data[i]["func"], func_data[i]["params"], current_context, context);
1415
- } else {
1416
- current_context = ExecuteMethod.getSingleProperty(func_data[i]["func"], current_context);
1417
- }
1418
- i++;
1419
- }
1420
- return current_context;
1421
- }
1422
- };
1423
-
1424
- if (!String.prototype.trim) {
1425
- String.prototype.trim = function() {
1426
- return this.replace(/^\s+|\s+$/g, '');
1427
- };
1428
- }
1429
-
1430
- if (window.ExecuteMethod === "undefined" || window.ExecuteMethod === null || window.ExecuteMethod === void 0) {
1431
- window.ExecuteMethod = ExecuteMethod;
1432
- }
1433
-
1434
- }).call(this);;/*
1435
- * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
1436
- *
1437
- * Uses the built in easing capabilities added In jQuery 1.1
1438
- * to offer multiple easing options
1439
- *
1440
- * TERMS OF USE - jQuery Easing
1441
- *
1442
- * Open source under the BSD License.
1443
- *
1444
- * Copyright © 2008 George McGinley Smith
1445
- * All rights reserved.
1446
- *
1447
- * Redistribution and use in source and binary forms, with or without modification,
1448
- * are permitted provided that the following conditions are met:
1449
- *
1450
- * Redistributions of source code must retain the above copyright notice, this list of
1451
- * conditions and the following disclaimer.
1452
- * Redistributions in binary form must reproduce the above copyright notice, this list
1453
- * of conditions and the following disclaimer in the documentation and/or other materials
1454
- * provided with the distribution.
1455
- *
1456
- * Neither the name of the author nor the names of contributors may be used to endorse
1457
- * or promote products derived from this software without specific prior written permission.
1458
- *
1459
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
1460
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1461
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1462
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1463
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
1464
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
1465
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1466
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1467
- * OF THE POSSIBILITY OF SUCH DAMAGE.
1468
- *
1469
- */
1470
-
1471
- jQuery(document).ready(function() {
1472
-
1473
-
1474
- // t: current time, b: begInnIng value, c: change In value, d: duration
1475
- jQuery.easing['jswing'] = jQuery.easing['swing'];
1476
-
1477
- jQuery.extend( jQuery.easing,
1478
- {
1479
- def: 'easeOutQuad',
1480
- swing: function (x, t, b, c, d) {
1481
- //alert(jQuery.easing.default);
1482
- return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
1483
- },
1484
- easeInQuad: function (x, t, b, c, d) {
1485
- return c*(t/=d)*t + b;
1486
- },
1487
- easeOutQuad: function (x, t, b, c, d) {
1488
- return -c *(t/=d)*(t-2) + b;
1489
- },
1490
- easeInOutQuad: function (x, t, b, c, d) {
1491
- if ((t/=d/2) < 1) return c/2*t*t + b;
1492
- return -c/2 * ((--t)*(t-2) - 1) + b;
1493
- },
1494
- easeInCubic: function (x, t, b, c, d) {
1495
- return c*(t/=d)*t*t + b;
1496
- },
1497
- easeOutCubic: function (x, t, b, c, d) {
1498
- return c*((t=t/d-1)*t*t + 1) + b;
1499
- },
1500
- easeInOutCubic: function (x, t, b, c, d) {
1501
- if ((t/=d/2) < 1) return c/2*t*t*t + b;
1502
- return c/2*((t-=2)*t*t + 2) + b;
1503
- },
1504
- easeInQuart: function (x, t, b, c, d) {
1505
- return c*(t/=d)*t*t*t + b;
1506
- },
1507
- easeOutQuart: function (x, t, b, c, d) {
1508
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
1509
- },
1510
- easeInOutQuart: function (x, t, b, c, d) {
1511
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
1512
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
1513
- },
1514
- easeInQuint: function (x, t, b, c, d) {
1515
- return c*(t/=d)*t*t*t*t + b;
1516
- },
1517
- easeOutQuint: function (x, t, b, c, d) {
1518
- return c*((t=t/d-1)*t*t*t*t + 1) + b;
1519
- },
1520
- easeInOutQuint: function (x, t, b, c, d) {
1521
- if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
1522
- return c/2*((t-=2)*t*t*t*t + 2) + b;
1523
- },
1524
- easeInSine: function (x, t, b, c, d) {
1525
- return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
1526
- },
1527
- easeOutSine: function (x, t, b, c, d) {
1528
- return c * Math.sin(t/d * (Math.PI/2)) + b;
1529
- },
1530
- easeInOutSine: function (x, t, b, c, d) {
1531
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
1532
- },
1533
- easeInExpo: function (x, t, b, c, d) {
1534
- return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
1535
- },
1536
- easeOutExpo: function (x, t, b, c, d) {
1537
- return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
1538
- },
1539
- easeInOutExpo: function (x, t, b, c, d) {
1540
- if (t==0) return b;
1541
- if (t==d) return b+c;
1542
- if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
1543
- return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
1544
- },
1545
- easeInCirc: function (x, t, b, c, d) {
1546
- return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
1547
- },
1548
- easeOutCirc: function (x, t, b, c, d) {
1549
- return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
1550
- },
1551
- easeInOutCirc: function (x, t, b, c, d) {
1552
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
1553
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
1554
- },
1555
- easeInElastic: function (x, t, b, c, d) {
1556
- var s=1.70158;var p=0;var a=c;
1557
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
1558
- if (a < Math.abs(c)) { a=c; var s=p/4; }
1559
- else var s = p/(2*Math.PI) * Math.asin (c/a);
1560
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
1561
- },
1562
- easeOutElastic: function (x, t, b, c, d) {
1563
- var s=1.70158;var p=0;var a=c;
1564
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
1565
- if (a < Math.abs(c)) { a=c; var s=p/4; }
1566
- else var s = p/(2*Math.PI) * Math.asin (c/a);
1567
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
1568
- },
1569
- easeInOutElastic: function (x, t, b, c, d) {
1570
- var s=1.70158;var p=0;var a=c;
1571
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
1572
- if (a < Math.abs(c)) { a=c; var s=p/4; }
1573
- else var s = p/(2*Math.PI) * Math.asin (c/a);
1574
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
1575
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
1576
- },
1577
- easeInBack: function (x, t, b, c, d, s) {
1578
- if (s == undefined) s = 1.70158;
1579
- return c*(t/=d)*t*((s+1)*t - s) + b;
1580
- },
1581
- easeOutBack: function (x, t, b, c, d, s) {
1582
- if (s == undefined) s = 1.70158;
1583
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
1584
- },
1585
- easeInOutBack: function (x, t, b, c, d, s) {
1586
- if (s == undefined) s = 1.70158;
1587
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
1588
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
1589
- },
1590
- easeInBounce: function (x, t, b, c, d) {
1591
- return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
1592
- },
1593
- easeOutBounce: function (x, t, b, c, d) {
1594
- if ((t/=d) < (1/2.75)) {
1595
- return c*(7.5625*t*t) + b;
1596
- } else if (t < (2/2.75)) {
1597
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
1598
- } else if (t < (2.5/2.75)) {
1599
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
1600
- } else {
1601
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
1602
- }
1603
- },
1604
- easeInOutBounce: function (x, t, b, c, d) {
1605
- if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
1606
- return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
1607
- }
1608
- });
1609
-
1610
- /*
1611
- *
1612
- * TERMS OF USE - EASING EQUATIONS
1613
- *
1614
- * Open source under the BSD License.
1615
- *
1616
- * Copyright © 2001 Robert Penner
1617
- * All rights reserved.
1618
- *
1619
- * Redistribution and use in source and binary forms, with or without modification,
1620
- * are permitted provided that the following conditions are met:
1621
- *
1622
- * Redistributions of source code must retain the above copyright notice, this list of
1623
- * conditions and the following disclaimer.
1624
- * Redistributions in binary form must reproduce the above copyright notice, this list
1625
- * of conditions and the following disclaimer in the documentation and/or other materials
1626
- * provided with the distribution.
1627
- *
1628
- * Neither the name of the author nor the names of contributors may be used to endorse
1629
- * or promote products derived from this software without specific prior written permission.
1630
- *
1631
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
1632
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1633
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1634
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1635
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
1636
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
1637
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1638
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
1639
- * OF THE POSSIBILITY OF SUCH DAMAGE.
1640
- *
1641
- */
1642
-
1643
- });;/*
1644
- * $ lightbox_me
1645
- * By: Buck Wilson
1646
- * Version : 2.3
1647
- *
1648
- * Licensed under the Apache License, Version 2.0 (the "License");
1649
- * you may not use this file except in compliance with the License.
1650
- * You may obtain a copy of the License at
1651
- *
1652
- * http://www.apache.org/licenses/LICENSE-2.0
1653
- *
1654
- * Unless required by applicable law or agreed to in writing, software
1655
- * distributed under the License is distributed on an "AS IS" BASIS,
1656
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1657
- * See the License for the specific language governing permissions and
1658
- * limitations under the License.
1659
- */
1660
-
1661
-
1662
- (function($) {
1663
-
1664
- $.fn.lightbox_me = function(options) {
1665
-
1666
- return this.each(function() {
1667
-
1668
- var
1669
- opts = $.extend({}, $.fn.lightbox_me.defaults, options),
1670
- $overlay = $(),
1671
- $self = $(this),
1672
- $iframe = $('<iframe id="foo" style="z-index: ' + (opts.zIndex + 1) + ';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>'),
1673
- ie6 = ($.browser.msie && $.browser.version < 7);
1674
-
1675
- if (opts.showOverlay) {
1676
- //check if there's an existing overlay, if so, make subequent ones clear
1677
- var $currentOverlays = $(".js_lb_overlay:visible");
1678
- if ($currentOverlays.length > 0){
1679
- $overlay = $('<div class="lb_overlay_clear js_lb_overlay"/>');
1680
- } else {
1681
- $overlay = $('<div class="' + opts.classPrefix + '_overlay js_lb_overlay"/>');
1682
- }
1683
- }
1684
-
1685
- /*----------------------------------------------------
1686
- DOM Building
1687
- ---------------------------------------------------- */
1688
- if (ie6) {
1689
- var src = /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank';
1690
- $iframe.attr('src', src);
1691
- $('body').append($iframe);
1692
- } // iframe shim for ie6, to hide select elements
1693
- $('body').append($self.hide()).append($overlay);
1694
-
1695
-
1696
- /*----------------------------------------------------
1697
- Overlay CSS stuffs
1698
- ---------------------------------------------------- */
1699
-
1700
- // set css of the overlay
1701
- if (opts.showOverlay) {
1702
- setOverlayHeight(); // pulled this into a function because it is called on window resize.
1703
- $overlay.css({ position: 'absolute', width: '100%', top: 0, left: 0, right: 0, bottom: 0, zIndex: (opts.zIndex + 2), display: 'none' });
1704
- if (!$overlay.hasClass('lb_overlay_clear')){
1705
- $overlay.css(opts.overlayCSS);
1706
- }
1707
- }
1708
-
1709
- /*----------------------------------------------------
1710
- Animate it in.
1711
- ---------------------------------------------------- */
1712
- //
1713
- if (opts.showOverlay) {
1714
- $overlay.fadeIn(opts.overlaySpeed, function() {
1715
- setSelfPosition();
1716
- $self[opts.appearEffect](opts.lightboxSpeed, function() { setOverlayHeight(); setSelfPosition(); opts.onLoad()});
1717
- });
1718
- } else {
1719
- setSelfPosition();
1720
- $self[opts.appearEffect](opts.lightboxSpeed, function() { opts.onLoad()});
1721
- }
1722
-
1723
- /*----------------------------------------------------
1724
- Hide parent if parent specified (parentLightbox should be jquery reference to any parent lightbox)
1725
- ---------------------------------------------------- */
1726
- if (opts.parentLightbox) {
1727
- opts.parentLightbox.fadeOut(200);
1728
- }
1729
-
1730
-
1731
- /*----------------------------------------------------
1732
- Bind Events
1733
- ---------------------------------------------------- */
1734
-
1735
- $(window).resize(setOverlayHeight)
1736
- .resize(setSelfPosition)
1737
- .scroll(setSelfPosition);
1738
-
1739
- $(window).bind('keyup.lightbox_me', observeKeyPress);
1740
-
1741
- if (opts.closeClick) {
1742
- $overlay.click(function(e) { closeLightbox(); e.preventDefault; });
1743
- }
1744
- $self.delegate(opts.closeSelector, "click", function(e) {
1745
- closeLightbox(); e.preventDefault();
1746
- });
1747
- $self.bind('close', closeLightbox);
1748
- $self.bind('reposition', setSelfPosition);
1749
-
1750
-
1751
-
1752
- /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1753
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
1754
-
1755
-
1756
- /*----------------------------------------------------
1757
- Private Functions
1758
- ---------------------------------------------------- */
1759
-
1760
- /* Remove or hide all elements */
1761
- function closeLightbox() {
1762
- var s = $self[0].style;
1763
- if (opts.destroyOnClose) {
1764
- $self.add($overlay).remove();
1765
- } else {
1766
- $self.add($overlay).hide();
1767
- }
1768
-
1769
- //show the hidden parent lightbox
1770
- if (opts.parentLightbox) {
1771
- opts.parentLightbox.fadeIn(200);
1772
- }
1773
-
1774
- $iframe.remove();
1775
-
1776
- // clean up events.
1777
- $self.undelegate(opts.closeSelector, "click");
1778
-
1779
- $(window).unbind('reposition', setOverlayHeight);
1780
- $(window).unbind('reposition', setSelfPosition);
1781
- $(window).unbind('scroll', setSelfPosition);
1782
- $(window).unbind('keyup.lightbox_me');
1783
- if (ie6)
1784
- s.removeExpression('top');
1785
- opts.onClose();
1786
- }
1787
-
1788
-
1789
- /* Function to bind to the window to observe the escape/enter key press */
1790
- function observeKeyPress(e) {
1791
- if((e.keyCode == 27 || (e.DOM_VK_ESCAPE == 27 && e.which==0)) && opts.closeEsc) closeLightbox();
1792
- }
1793
-
1794
-
1795
- /* Set the height of the overlay
1796
- : if the document height is taller than the window, then set the overlay height to the document height.
1797
- : otherwise, just set overlay height: 100%
1798
- */
1799
- function setOverlayHeight() {
1800
- if ($(window).height() < $(document).height()) {
1801
- $overlay.css({height: $(document).height() + 'px'});
1802
- $iframe.css({height: $(document).height() + 'px'});
1803
- } else {
1804
- $overlay.css({height: '100%'});
1805
- if (ie6) {
1806
- $('html,body').css('height','100%');
1807
- $iframe.css('height', '100%');
1808
- } // ie6 hack for height: 100%; TODO: handle this in IE7
1809
- }
1810
- }
1811
-
1812
-
1813
- /* Set the position of the modal'd window ($self)
1814
- : if $self is taller than the window, then make it absolutely positioned
1815
- : otherwise fixed
1816
- */
1817
- function setSelfPosition() {
1818
- var s = $self[0].style;
1819
-
1820
- // reset CSS so width is re-calculated for margin-left CSS
1821
- $self.css({left: '50%', marginLeft: ($self.outerWidth() / 2) * -1, zIndex: (opts.zIndex + 3) });
1822
-
1823
-
1824
- /* we have to get a little fancy when dealing with height, because lightbox_me
1825
- is just so fancy.
1826
- */
1827
-
1828
- // if the height of $self is bigger than the window and self isn't already position absolute
1829
- if (($self.height() + 80 >= $(window).height()) && ($self.css('position') != 'absolute' || ie6)) {
1830
-
1831
- // we are going to make it positioned where the user can see it, but they can still scroll
1832
- // so the top offset is based on the user's scroll position.
1833
- var topOffset = $(document).scrollTop() + 40;
1834
- $self.css({position: 'absolute', top: topOffset + 'px', marginTop: 0})
1835
- if (ie6) {
1836
- s.removeExpression('top');
1837
- }
1838
- } else if ($self.height()+ 80 < $(window).height()) {
1839
- //if the height is less than the window height, then we're gonna make this thing position: fixed.
1840
- // in ie6 we're gonna fake it.
1841
- if (ie6) {
1842
- s.position = 'absolute';
1843
- if (opts.centered) {
1844
- s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')
1845
- s.marginTop = 0;
1846
- } else {
1847
- var top = (opts.modalCSS && opts.modalCSS.top) ? parseInt(opts.modalCSS.top) : 0;
1848
- s.setExpression('top', '((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"')
1849
- }
1850
- } else {
1851
- if (opts.centered) {
1852
- $self.css({ position: 'fixed', top: '50%', marginTop: ($self.outerHeight() / 2) * -1})
1853
- } else {
1854
- $self.css({ position: 'fixed'}).css(opts.modalCSS);
1855
- }
1856
-
1857
- }
1858
- }
1859
- }
1860
-
1861
- });
1862
-
1863
-
1864
-
1865
- };
1866
-
1867
- $.fn.lightbox_me.defaults = {
1868
-
1869
- // animation
1870
- appearEffect: "fadeIn",
1871
- appearEase: "",
1872
- overlaySpeed: 250,
1873
- lightboxSpeed: 300,
1874
-
1875
- // close
1876
- closeSelector: ".close",
1877
- closeClick: true,
1878
- closeEsc: true,
1879
-
1880
- // behavior
1881
- destroyOnClose: false,
1882
- showOverlay: true,
1883
- parentLightbox: false,
1884
-
1885
- // callbacks
1886
- onLoad: function() {},
1887
- onClose: function() {},
1888
-
1889
- // style
1890
- classPrefix: 'lb',
1891
- zIndex: 999,
1892
- centered: false,
1893
- modalCSS: {top: '40px'},
1894
- overlayCSS: {background: 'black', opacity: .3}
1895
- }
1896
- })(jQuery);;(function($) {
1897
-
1898
- window.SidekickWP = {
1899
- Models: {},
1900
- Collections: {},
1901
- Views: {},
1902
- Events: {},
1903
- Templates: {},
1904
- Helpers: {}
1905
- };
1906
-
1907
- if (!window.console) window.console = {log: function() {}};
1908
- if (!window.console.clear) window.console.clear = function(){};
1909
- if (!window.console.group) window.console.group = function(){};
1910
- if (!window.console.groupEnd) window.console.groupEnd = function(){};
1911
- if (!window.console.table) window.console.table = function(){};
1912
- if (!window.console.error) window.console.error = function(){};
1913
- if (!window.console.groupCollapsed) window.console.groupCollapsed = function(){};
1914
-
1915
- if (window.console){
1916
- window.console.info = function(msg,o1,o2,o3){if (!o1) o1 = '';if (!o2) o2 = '';if (!o3) o3 = '';console.log('%c' + msg,'color: blue;font-weight: bold',o1,o2,o3);};
1917
- window.console.event = function(msg,o1,o2,o3){if (!o1) o1 = '';if (!o2) o2 = '';if (!o3) o3 = '';console.log('%c' + msg,'color: green;font-weight: bold',o1,o2,o3);};
1918
- }
1919
-
1920
- SidekickWP.Models.App = Backbone.Model.extend({
1921
- defaults: {
1922
- full_library: null,
1923
- buckets: [],
1924
- passed_walkthroughs: [],
1925
- passed_current_page_walkthroughs: [],
1926
- library_filtered_hotspots: [],
1927
- paid_library: null,
1928
- my_library: null,
1929
- wp_version: null,
1930
- installed_plugins: null,
1931
- current_url: null,
1932
- current_plugin: null,
1933
- license_status: null,
1934
- show_toggle_feedback: true,
1935
- sk_debug: null,
1936
- qa_mode: false,
1937
- currentDebugMode: null,
1938
- tried_library_load_twice: false,
1939
- bucket_counts: []
1940
- },
1941
-
1942
- initialize: function(){
1943
- console.group('%cinitialize: App Model %o', 'color:#3b4580', this);
1944
-
1945
- if ( $.browser.msie && $.browser.version < 9) {
1946
- console.error('This browser is not supported');
1947
- return false;
1948
- }
1949
-
1950
- _.extend(this, Backbone.Events);
1951
- SidekickWP.Events = _.extend({}, Backbone.Events);
1952
-
1953
- SidekickWP.Events.on("all", function(eventName){
1954
- // console.log('%cPLR_REVENT: [ %c' + eventName + '%c ] was triggered!','background-color: #fa62bf;color: white','color: yellow; background-color: #fa4339','background-color: #fa4339;color: white');
1955
- });
1956
-
1957
- Sidekick.Events.on('loaded_walkthrough',this.loaded_walkthrough,this);
1958
- // Sidekick.Events.on('stop',this.show_review,this);
1959
- Sidekick.Events.on('stop',this.deactivate_controls,this);
1960
- Sidekick.Events.on('track_play',this.activate_controls,this);
1961
-
1962
- SidekickWP.Events.on('screen_activate',this.screen_activate,this);
1963
- SidekickWP.Events.on('show_msg',this.show_msg,this);
1964
-
1965
- this.trackingModel = new SidekickWP.Models.Tracking();
1966
-
1967
- var matched_domain = false;
1968
-
1969
- if (sk_config.plugin_url.indexOf('qa.sidekick.pro') > -1 || sk_config.plugin_url.indexOf('local.sidekick.pro') > -1) {
1970
- this.set('qa_mode',true);
1971
- }
1972
-
1973
- if(typeof sk_paid_library !== 'undefined' && _.size(sk_paid_library.buckets) > 0){
1974
- this.set('full_library',sk_paid_library);
1975
- this.set('paid_library',sk_paid_library);
1976
- console.log('%cFOUND sk_paid_library (%o) %o', 'background-color: #51fa3d; color black;',sk_config.library_paid_file,sk_paid_library);
1977
- } else if (typeof sk_free_library !== 'undefined' && _.size(sk_free_library.buckets) > 0){
1978
- this.set('full_library',sk_free_library);
1979
- console.log('%cFOUND sk_free_library (%o) %o', 'background-color: #f9fa58; color black;',sk_config.library_free_file,sk_free_library);
1980
- } else {
1981
- var msg = 'No Library Found!';
1982
-
1983
- if (this.get('tried_library_load_twice') === false) {
1984
- console.warn('msg %o', msg);
1985
- setTimeout($.proxy(function(){
1986
- this.initialize();
1987
- },this),2000);
1988
- this.set('tried_library_load_twice',true);
1989
- console.groupEnd();
1990
- return;
1991
- }
1992
-
1993
- SidekickWP.Events.trigger('track_error',{msg: msg});
1994
- console.groupEnd();
1995
- return false;
1996
- }
1997
-
1998
- if (typeof sk_config.just_activated != 'undefined')
1999
- SidekickWP.Events.trigger('window_activate');
2000
-
2001
- if (typeof sk_config.main_soft_version !== 'undefined') this.set('main_soft_version',sk_config.main_soft_version);
2002
- if (typeof sk_config.installed_plugins !== 'undefined') this.set('installed_plugins',sk_config.installed_plugins);
2003
-
2004
- this.set('current_url',window.location.toString());
2005
-
2006
- this.views = {};
2007
- this.check_library();
2008
- this.filter_walkthroughs();
2009
-
2010
- this.views.app = new SidekickWP.Views.App({model: this, el: $("body")});
2011
-
2012
- var sk_composer_preview_on = $.cookie('sk_composer_preview_on');
2013
- if (sk_composer_preview_on) {
2014
- console.log('sk_composer_preview_on restarting preview %o', sk_composer_preview_on);
2015
- Sidekick.Events.trigger('resume_preview');
2016
- }
2017
-
2018
- if (sk_config.show_login === true) {
2019
- SidekickWP.Events.trigger('open_sidekick_drawer');
2020
- }
2021
-
2022
- console.groupEnd();
2023
- },
2024
-
2025
- screen_activate: function(){
2026
- SidekickWP.Events.trigger('open_sidekick_drawer');
2027
-
2028
- var activation_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
2029
- if (sk_config.activation_id) {
2030
- activation_id = sk_config.activation_id;
2031
- }
2032
-
2033
- new SidekickWP.Models.User({
2034
- 'view': 'activate',
2035
- 'primary_domain': sk_config.domain,
2036
- 'activation_id': activation_id
2037
- });
2038
- },
2039
-
2040
- filter_walkthroughs: function(){
2041
- // console.group('%cFilter Walkthroughs','color: #8526ff');
2042
- console.groupCollapsed('%cFilter Walkthroughs','color: #8526ff');
2043
- var library = this.get('full_library');
2044
- _.each(library.buckets,function(item,key){
2045
- this.filter_sub_bucket_recursive(item);
2046
- },this);
2047
-
2048
- console.log('filter_walkthroughs library.buckets %o', library.buckets);
2049
-
2050
- _.each(library.buckets,function(item,key){
2051
- // Delete root bucket if no sub buckets
2052
- this.check_delete_empty_sub_buckets_recrusive(item);
2053
-
2054
- if (_.size(library.buckets[key].sub_buckets) === 0 && _.size(library.buckets[key].walkthroughs) === 0) {
2055
- console.log('%cDELETE ROOT BUCKET -> %o(%o)','color: red',key,library.buckets[key]);
2056
- delete(library.buckets[key]);
2057
- }
2058
- },this);
2059
- console.groupEnd();
2060
- },
2061
-
2062
- check_delete_empty_sub_buckets_recrusive: function(sub_bucket){
2063
- console.groupCollapsed('%ccheck_delete_empty_sub_buckets_recrusive %o (%o)', 'color: #d2984c;',sub_bucket.post_title,sub_bucket);
2064
-
2065
- if (_.size(sub_bucket.sub_buckets) > 0) {
2066
- _.each(sub_bucket.sub_buckets,function(item,key){
2067
- if (!this.check_delete_empty_sub_buckets_recrusive(item)) {
2068
- console.log('%cDELETE key %o', 'color: red;',key);
2069
- delete(sub_bucket.sub_buckets[key]);
2070
- }
2071
- },this);
2072
-
2073
- console.groupEnd();
2074
- if (_.size(sub_bucket.sub_buckets) === 0 && _.size(sub_bucket.walkthroughs) === 0 ) {
2075
- console.log('Delete parent sub bucket as it has no more children');
2076
- return false;
2077
- } else {
2078
- return true;
2079
- }
2080
-
2081
- } else if (_.size(sub_bucket.sub_buckets) === 0 && _.size(sub_bucket.walkthroughs) === 0 ){
2082
- console.groupEnd();
2083
- return false;
2084
- }
2085
- console.groupEnd();
2086
- return true;
2087
- },
2088
-
2089
- filter_sub_bucket_recursive: function(sub_bucket){
2090
- console.group('%cfilter_sub_bucket_recursive - %c %s (%o)', 'color: #ff6f29','color: white;background-color: black',sub_bucket.post_title, sub_bucket);
2091
-
2092
- if (_.size(sub_bucket.sub_buckets) > 0) {
2093
- _.each(sub_bucket.sub_buckets,function(item,key){
2094
- return this.filter_sub_bucket_recursive(item);
2095
- },this);
2096
- } else if (_.size(sub_bucket.walkthroughs)) {
2097
- // Filter walkthrough
2098
- sub_bucket.walkthroughs.reverse();
2099
- var key = sub_bucket.walkthroughs.length;
2100
- while (key--) {
2101
- var walkthrough = sub_bucket.walkthroughs[key];
2102
- if (!this.check_walkthrough_compatibility(walkthrough)) {
2103
- // console.log(' %cDELETE %s %o','color: red', sub_bucket.walkthroughs[key].title, sub_bucket.walkthroughs[key]);
2104
- sub_bucket.walkthroughs.splice(key, 1);
2105
- continue;
2106
- }
2107
-
2108
- // Check if Hotspot, if so move out
2109
- if (walkthrough.type == 'hotspot') {
2110
- _.each(walkthrough.hotspots,function(item){
2111
- // console.info('HOTSPOT %o', walkthrough.title);
2112
- var library_filtered_hotspots = this.get('library_filtered_hotspots');
2113
- library_filtered_hotspots.push({
2114
- url:item.url,selector:
2115
- item.selector,id:walkthrough.id
2116
- });
2117
- this.set('library_filtered_hotspots',library_filtered_hotspots);
2118
- },this);
2119
- // console.log('%cDELETE2 sub_bucket.walkthroughs[key] %o %o','color: red', key,sub_bucket.walkthroughs[key]);
2120
- sub_bucket.walkthroughs.splice(key, 1);
2121
- continue;
2122
- }
2123
- }
2124
- } else {
2125
- // Sub_bucket has no walkthroughs
2126
- console.log('CCC Sub_bucket has no walkthroughs');
2127
- }
2128
- console.groupEnd();
2129
- return false;
2130
- },
2131
-
2132
- check_walkthrough_compatibility: function(walkthrough){
2133
- var main_soft_version = this.get('main_soft_version');
2134
- var pass_main_soft_version = false, pass_theme_version = false, pass_theme = false, pass_plugin = false, pass_plugin_version = false, pass_user_level = false;
2135
- var bucket_counts = this.get('bucket_counts');
2136
- var installed_plugins = this.get('installed_plugins') ;
2137
-
2138
- // Checking Main Software Version Compatibility
2139
- if (walkthrough.main_soft_version) {
2140
- pass_main_soft_version = _.find(walkthrough.main_soft_version,function(val){
2141
- if (val == main_soft_version)
2142
- return true;
2143
- });
2144
- } else {
2145
- // If no assigned main_soft_version assume not needed
2146
- pass_main_soft_version = true;
2147
- }
2148
-
2149
-
2150
- if (!pass_main_soft_version){
2151
- console.log('%cFAILED %s - SOFT_VER %o != %O','color: red',walkthrough.title, main_soft_version,walkthrough.main_soft_version);
2152
- return false;
2153
- }
2154
-
2155
- // Checking Theme Compatibility
2156
- if (typeof walkthrough.theme !== 'undefined') {
2157
- if (walkthrough.theme === sk_config.installed_theme) {
2158
- pass_theme = true;
2159
- if (walkthrough.theme_version) {
2160
- pass_theme_version = _.find(walkthrough.theme_version,function(val){
2161
- if (val == sk_config.theme_version) {
2162
- return true;
2163
- }
2164
- });
2165
- } else {
2166
- pass_theme_version = true;
2167
- }
2168
- }
2169
- if (!pass_theme || !pass_theme_version){
2170
- console.log('%cFAILED %s - THEME %s (%o) != %s (%o)','color: red',walkthrough.title,walkthrough.theme_version, walkthrough.theme, pass_theme, sk_config.theme_version);
2171
- return false;
2172
- }
2173
- }
2174
-
2175
- // Checking Plugin Compatibility
2176
- if (typeof walkthrough.plugin !== 'undefined') {
2177
- if (typeof sk_config.installed_plugins === 'undefined')
2178
- return false;
2179
-
2180
- pass_plugin = _.find(sk_config.installed_plugins,function(plugin_data){
2181
- for (var plugin in plugin_data) {
2182
- var version = plugin_data[plugin];
2183
-
2184
- if (plugin == walkthrough.plugin || _.escape(plugin) == walkthrough.plugin) {
2185
- pass_plugin = true;
2186
-
2187
- if (typeof walkthrough.plugin_version === 'undefined') {
2188
- pass_plugin_version = true;
2189
- return true;
2190
- }
2191
-
2192
- pass_plugin_version = _.find(walkthrough.plugin_version,function(version2){
2193
- if (version == version2) {
2194
- pass_plugin_version = true;
2195
- return true;
2196
- }
2197
- });
2198
- return true;
2199
- }
2200
- break;
2201
- }
2202
- });
2203
-
2204
- if (!pass_plugin) {
2205
- console.log('%cFAILED %s (%o) - PLUGIN %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, sk_config);
2206
- return false;
2207
- }
2208
-
2209
- console.log('pass_plugin_version %o', pass_plugin_version);
2210
-
2211
-
2212
- if (!pass_plugin_version){
2213
- console.log('%cFAILED %s (%o) - PLUGIN %s VER %s (%o)','color: red',walkthrough.title, walkthrough, walkthrough.plugin, walkthrough.plugin_version, sk_config);
2214
- return false;
2215
- }
2216
- }
2217
-
2218
- // Checking User Role/Level Compatibility
2219
- if (walkthrough.role) {
2220
- pass_user_level = _.find(walkthrough.role,function(val){
2221
- if (val == sk_config.user_level) {
2222
- return true;
2223
- }
2224
- });
2225
- } else {
2226
- // No User Level Defined so assume not needed
2227
- pass_user_level = true;
2228
- }
2229
-
2230
- if (!pass_user_level){
2231
- console.log('%cFAILED %s - User Level %s != %s','color: red',walkthrough.title, sk_config.user_level, walkthrough.role);
2232
- return false;
2233
- }
2234
-
2235
- var page_related_walkthrough = false;
2236
-
2237
- // Check display rules
2238
- if (walkthrough.display_rules) {
2239
- console.log('walkthrough.display_rules %o', walkthrough.display_rules);
2240
- for ( var rule in walkthrough.display_rules){
2241
- var rule_data = walkthrough.display_rules[rule];
2242
-
2243
- // if (!isNaN(rule_data.value)) {
2244
- // rule_data.value = parseInt(rule_data.value,10);
2245
- // }
2246
-
2247
- if (this.isNumeric(sk_config[rule_data.variable])) {
2248
- // console.log('CONVERTING TO INTEGER');
2249
- sk_config[rule_data.variable] = parseInt(sk_config[rule_data.variable],10);
2250
- }
2251
-
2252
- if (rule_data.value == "true" || rule_data.value == "yes" || rule_data.value == "1"){
2253
- // console.log('TRUE');
2254
- rule_data.value = true;
2255
- }
2256
-
2257
- if (rule_data.value == "false" || rule_data.value == "no" || rule_data.value == "0" || rule_data.value === null){
2258
- // console.log('FALSE');
2259
- rule_data.value = false;
2260
- }
2261
-
2262
- if (sk_config[rule_data.variable] == "true" || sk_config[rule_data.variable] == "yes" || sk_config[rule_data.variable] == "1"){
2263
- // console.log('TRUE');
2264
- sk_config[rule_data.variable] = true;
2265
- }
2266
-
2267
- if (sk_config[rule_data.variable] == "false" || sk_config[rule_data.variable] == "no" || sk_config[rule_data.variable] == "0" || sk_config[rule_data.variable] === null){
2268
- // console.log('FALSE');
2269
- sk_config[rule_data.variable] = false;
2270
- }
2271
-
2272
- if (rule_data.operator.toLowerCase() === 'equals') {
2273
- if (!(sk_config[rule_data.variable] === rule_data.value)) {
2274
- console.groupCollapsed('%cFAILED Custom Rule [%s] %s === %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2275
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2276
- console.log('rule_data.value %o', rule_data.value);
2277
- console.log('sk_config[rule_data.variable] !== rule_data.value %o', sk_config[rule_data.variable] !== rule_data.value);
2278
- console.groupEnd();
2279
- return false;
2280
- }
2281
- } else if (rule_data.operator.toLowerCase() === 'not equal to') {
2282
- if (!(sk_config[rule_data.variable] !== rule_data.value)) {
2283
- console.groupCollapsed('%cFAILED Custom Rule [%s] %s !== %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2284
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2285
- console.log('rule_data.value %o', rule_data.value);
2286
- console.log('sk_config[rule_data.variable] === rule_data.value %o', sk_config[rule_data.variable] === rule_data.value);
2287
- console.groupEnd();
2288
- return false;
2289
- }
2290
- } else if (rule_data.operator.toLowerCase() === 'greater then') {
2291
- if (isNaN(sk_config[rule_data.variable]) || isNaN(rule_data.value)) {
2292
- console.groupCollapsed('%cFAILED Custom Rule [%s] Can\'t compare non integers %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2293
- console.groupEnd();
2294
- return false;
2295
- }
2296
- if (!(sk_config[rule_data.variable] > rule_data.value)) {
2297
- console.groupCollapsed('%cFAILED Custom Rule [%s] %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2298
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2299
- console.log('rule_data.value %o', rule_data.value);
2300
- console.log('sk_config[rule_data.variable] > rule_data.value %o', sk_config[rule_data.variable] > rule_data.value);
2301
- console.groupEnd();
2302
- return false;
2303
- }
2304
- } else if (rule_data.operator.toLowerCase() === 'less then') {
2305
- if (isNaN(sk_config[rule_data.variable]) || isNaN(rule_data.value)) {
2306
- console.groupCollapsed('%cFAILED Custom Rule [%s] Can\'t compare non integers %s > %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2307
- console.groupEnd();
2308
- return false;
2309
- }
2310
- if (!(sk_config[rule_data.variable] < rule_data.value)) {
2311
- console.groupCollapsed('%cFAILED Custom Rule [%s] %s < %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2312
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2313
- console.log('rule_data.value %o', rule_data.value);
2314
- console.log('sk_config[rule_data.variable] < rule_data.value %o', sk_config[rule_data.variable] < rule_data.value);
2315
- console.groupEnd();
2316
- return false;
2317
- }
2318
- } else if (rule_data.operator.toLowerCase() === 'contains') {
2319
- if (typeof sk_config[rule_data.variable] === 'undefined' || sk_config[rule_data.variable].indexOf(rule_data.value) === -1) {
2320
- console.groupCollapsed('%cFAILED Custom Rule [%s] %s < %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2321
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2322
- console.log('rule_data.value %o', rule_data.value);
2323
- console.log('sk_config[rule_data.variable] < rule_data.value %o', sk_config[rule_data.variable] < rule_data.value);
2324
- console.groupEnd();
2325
- return false;
2326
- } else {
2327
- page_related_walkthrough = true;
2328
- }
2329
- } else {
2330
- console.groupCollapsed('%cFAILED Unrecognized Rule [%s] %s < %s','color: red',rule_data.operator.toLowerCase(),rule_data.variable, rule_data.value);
2331
- console.groupEnd();
2332
- return false;
2333
- }
2334
- console.groupCollapsed('%cPASSED Custom Rule %s %s %s','color: #3ab00b',rule_data.variable, sk_config[rule_data.variable], rule_data.operator.toLowerCase(), rule_data.value);
2335
- console.log('sk_config[rule_data.variable] %o', sk_config[rule_data.variable]);
2336
- console.log('rule_data.value %o', rule_data.value);
2337
- console.log('sk_config[rule_data.variable] %s rule_data.value %o', rule_data.operator, sk_config[rule_data.variable] < rule_data.value);
2338
- console.groupEnd();
2339
- }
2340
- }
2341
-
2342
- var passed_walkthroughs = this.get('passed_walkthroughs');
2343
- passed_walkthroughs.push(walkthrough.id);
2344
- this.set('passed_walkthroughs',passed_walkthroughs);
2345
-
2346
- if (page_related_walkthrough) {
2347
- var passed_current_page_walkthroughs = this.get('passed_current_page_walkthroughs');
2348
- passed_current_page_walkthroughs.push({
2349
- id: walkthrough.id,
2350
- title: walkthrough.title,
2351
- type: walkthrough.type
2352
- });
2353
- this.set('passed_current_page_walkthroughs',passed_current_page_walkthroughs);
2354
- }
2355
-
2356
- if (walkthrough.plugin) {
2357
- console.log('%cPASSED %s', 'color: #3ab00b',walkthrough.plugin + ': ' + walkthrough.title + '(' + walkthrough.id + ')');
2358
- } else {
2359
- console.log('%cPASSED %s', 'color: #3ab00b',walkthrough.title + '(' + walkthrough.id + ')');
2360
- }
2361
-
2362
- return true;
2363
- },
2364
-
2365
- isNumeric: function(n) {
2366
- return !isNaN(parseFloat(n)) && isFinite(n);
2367
- },
2368
-
2369
- stringToBoolean: function(string){
2370
- switch(string.toLowerCase()){
2371
- case "true": case "yes": case "1": return true;
2372
- case "false": case "no": case "0": case null: return false;
2373
- default: return Boolean(string);
2374
- }
2375
- },
2376
-
2377
- check_library: function(){
2378
- if (!this.get('full_library')) {
2379
- console.error("WPU Library Not Found!");
2380
- return false;
2381
- }
2382
- if (!this.get('main_soft_version')){
2383
- console.error("No WP Version Found!");
2384
- return false;
2385
- }
2386
- },
2387
-
2388
- loaded_walkthrough: function(walkthrough_model){
2389
- // console.log('WPU:loaded_walkthrough');
2390
- this.set('last_loaded_walkthrough',walkthrough_model);
2391
- },
2392
-
2393
- open_bucket: function(bucket_id){
2394
- this.views.app.open_bucket(bucket_id);
2395
- },
2396
-
2397
- activate_controls: function(){
2398
- console.log('activate_controls');
2399
- $('div#sidekick').addClass('playing');
2400
- },
2401
-
2402
- deactivate_controls: function(){
2403
- $('div#sidekick').removeClass('playing');
2404
- },
2405
-
2406
- turn_on_composer: function(){
2407
- SidekickWP.Events.trigger('composer_mode',true);
2408
- },
2409
-
2410
- turn_off_composer: function(){
2411
- SidekickWP.Events.trigger('composer_mode',false);
2412
- },
2413
-
2414
- show_msg: function(data,context){
2415
- // console.log('show_msg %o',arguments);
2416
- new SidekickWP.Models.Message({title: data.title, message: data.msg});
2417
- },
2418
- getParameterByName: function(name) {
2419
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
2420
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
2421
- results = regex.exec(location.search);
2422
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
2423
- }
2424
- });
2425
- }(jQuery));;(function($) {
2426
-
2427
- SidekickWP.Models.BucketContainer = Backbone.Model.extend({
2428
- defaults: {
2429
- full_library: null,
2430
- sub_bucket_height: null,
2431
- sub_bucket_inner_height: null,
2432
- currentDebugMode: null
2433
- },
2434
-
2435
- initialize: function(){
2436
- this.view = new SidekickWP.Views.BucketContainer({model: this});
2437
- return this;
2438
- },
2439
-
2440
- find_bucket: function(bucket_id){
2441
- var library = this.get('full_library');
2442
-
2443
- var found = false;
2444
-
2445
- if (bucket_id === 0) {
2446
- return {bucket:{
2447
- post_title: 'test',
2448
- sub_buckets: library.buckets
2449
- }};
2450
- }
2451
-
2452
- console.log('find_bucket %o', library);
2453
-
2454
- var found_bucket = false;
2455
-
2456
- _.find(library.buckets,function(item,key){
2457
- // console.log('key %o (%o) %o', key,item.id,item);
2458
-
2459
- var find_bucket = this.find_bucket_recrusive(bucket_id,item);
2460
- // console.log('00find_bucket %o', find_bucket);
2461
-
2462
- if (find_bucket) {
2463
- // console.log('FOUND IT!!!');
2464
- // console.log('find_bucket %o', find_bucket);
2465
- found_bucket = find_bucket;
2466
- return true;
2467
- } else {
2468
- // console.log('look at next root bucket');
2469
- }
2470
- },this);
2471
-
2472
- // console.log('*** found_bucket %o', found_bucket);
2473
-
2474
- return found_bucket;
2475
- },
2476
-
2477
- find_bucket_recrusive: function(bucket_id,bucket){
2478
- // console.log('find_bucket %o in %o (%o)', bucket_id,bucket,bucket.id);
2479
-
2480
- var found_bucket = false;
2481
-
2482
- if (bucket_id === bucket.id) {
2483
- // console.log('FOUND');
2484
- return {parent: false,bucket: bucket};
2485
- }
2486
-
2487
- if (bucket.id !== bucket_id && _.size(bucket.sub_buckets) > 0) {
2488
- // console.log('Looking Deeper');
2489
- _.find(bucket.sub_buckets,function(item,key){
2490
- // console.log('key %o', key);
2491
-
2492
- if (this.find_bucket_recrusive(bucket_id,item)) {
2493
- // console.log('FOUND A');
2494
- found_bucket = {parent: bucket,bucket: item};
2495
- return true;
2496
- }
2497
- },this);
2498
- } else {
2499
- // console.log('Not found nothing more to check here');
2500
- return false;
2501
- }
2502
- return found_bucket;
2503
- }
2504
-
2505
-
2506
- });
2507
-
2508
- }(jQuery));;(function($) {
2509
-
2510
- SidekickWP.Models.Bucket = Backbone.Model.extend({
2511
- defaults: {
2512
- full_library: null,
2513
- passed_current_page_walkthroughs: null
2514
- },
2515
-
2516
- initialize: function(){
2517
- // console.log('initialize bucketModel %o', this.attributes);
2518
- this.view = new SidekickWP.Views.Bucket({model: this});
2519
- return this;
2520
- }
2521
- });
2522
-
2523
- }(jQuery));;(function($) {
2524
-
2525
- SidekickWP.Helpers = ({
2526
- preventScrolling: function(){
2527
- $('div#sidekick .bucketContainer>div>ul').on('DOMMouseScroll mousewheel', function(ev) {
2528
- console.log('asd');
2529
- var $this = $(this),
2530
- scrollTop = this.scrollTop,
2531
- scrollHeight = this.scrollHeight,
2532
- height = $this.height(),
2533
- delta = (ev.type == 'DOMMouseScroll' ?
2534
- ev.originalEvent.detail * -40 :
2535
- ev.originalEvent.wheelDelta),
2536
- up = delta > 0;
2537
-
2538
- var prevent = function() {
2539
- ev.stopPropagation();
2540
- ev.preventDefault();
2541
- ev.returnValue = false;
2542
- return false;
2543
- };
2544
-
2545
- if (!up && -delta > scrollHeight - height - scrollTop) {
2546
- // Scrolling down, but this will take us past the bottom.
2547
- $this.scrollTop(scrollHeight);
2548
- return prevent();
2549
- } else if (up && delta > scrollTop) {
2550
- // Scrolling up, but this will take us past the top.
2551
- $this.scrollTop(0);
2552
- return prevent();
2553
- }
2554
- });
2555
- }
2556
- });
2557
- }(jQuery));
2558
-
2559
- ;(function($) {
2560
-
2561
- SidekickWP.Models.Message = Backbone.Model.extend({
2562
- defaults: {
2563
- title: null,
2564
- message: null
2565
- },
2566
-
2567
- initialize: function(){
2568
- this.view = new SidekickWP.Views.Message({model: this, el: $("#sidekick ul.bucketContainer div")});
2569
- }
2570
- });
2571
-
2572
- }(jQuery));;(function($) {
2573
-
2574
- SidekickWP.Models.Review = Backbone.Model.extend({
2575
- defaults: {
2576
- walkthrough_title: null
2577
- },
2578
-
2579
- initialize: function(){
2580
- this.view = new SidekickWP.Views.Review({model: this, el: $("#sidekick .bucketContainer div")});
2581
- }
2582
- });
2583
-
2584
- }(jQuery));;(function($) {
2585
-
2586
- SidekickWP.Models.Tracking = Backbone.Model.extend({
2587
- defaults : {
2588
- gaAccountID : 'UA-39283622-1'
2589
- },
2590
-
2591
- initialize: function(){
2592
- SidekickWP.Events.on('track_open_sidekick_window', this.track_open_sidekick_window, this);
2593
- SidekickWP.Events.on('track_explore', this.track_explore, this);
2594
- SidekickWP.Events.on('window_activate', this.window_activate, this);
2595
- SidekickWP.Events.on('window_deactivate', this.window_deactivate, this);
2596
- SidekickWP.Events.on('track_error', this.track_error, this);
2597
-
2598
- window._gaq = window._gaq || [];
2599
- window._gaq.push(['sidekickWP._setAccount', this.get('gaAccountID')]);
2600
-
2601
- (function() {
2602
- var ga_sk = document.createElement('script'); ga_sk.type = 'text/javascript'; ga_sk.async = true;
2603
- ga_sk.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
2604
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga_sk, s);
2605
- })();
2606
- },
2607
-
2608
- send: function(data){
2609
- if (typeof sk_config.tracking_off !== 'undefined' && sk_config.tracking_off === true) {
2610
- console.log("Tracking is off!");
2611
- return false;
2612
- }
2613
-
2614
- model = window.sidekickWP || {};
2615
-
2616
- data = data || {};
2617
- data.source = 'plugin';
2618
- data.action = 'track';
2619
- data.config = sk_config;
2620
-
2621
- if (typeof sidekick !== 'undefined' && (typeof sk_config.track_data === 'undefined' || sk_config.track_data === true)) {
2622
- data.user = sk_config.license_key;
2623
- }
2624
-
2625
- var http = 'http';
2626
- if (window.location.toString().indexOf('https') > -1) {
2627
- http = 'https';
2628
- }
2629
-
2630
- console.log('WP: send tracking to WPU',data);
2631
-
2632
- $.post(http + "://api.sidekick.pro/v3/events/", data);
2633
- // $.post(http + "://library.sidekick.pro/wp-admin/admin-ajax.php", data);
2634
- },
2635
-
2636
- track_explore: function(data){
2637
- window._gaq.push(['sidekickWP._trackEvent', 'Plugin - Explore', data.what, null, 0,true]);
2638
- this.send({type: 'explore', label: data.what, data: data.id});
2639
- },
2640
-
2641
- track_open_sidekick_window: function(data){
2642
- window._gaq.push(['sidekickWP._trackEvent', 'Plugin - Window', 'Open', null, 0,true]);
2643
- this.send({type: 'open'});
2644
- },
2645
-
2646
- window_activate: function(data){
2647
- window._gaq.push(['sidekickWP._trackEvent', 'Plugin - Activate', '', sk_config.wpu_plugin_version, 0,true]);
2648
- this.send({type: 'activate'});
2649
- },
2650
-
2651
- window_deactivate: function(data){
2652
- window._gaq.push(['sidekickWP._trackEvent', 'Plugin - Deactivate', '', sk_config.wpu_plugin_version, 0,true]);
2653
- this.send({type: 'deactivate'});
2654
- },
2655
-
2656
- track_error: function(data){
2657
- window._gaq.push(['sidekickWP._trackEvent', 'Plugin', 'Error', data.msg,null,true]);
2658
- this.send({type: 'error', label: data.msg});
2659
- }
2660
-
2661
- });
2662
-
2663
- }(jQuery));
2664
-
2665
-
2666
- ;(function($) {
2667
-
2668
- SidekickWP.Models.User = Backbone.Model.extend({
2669
- defaults: {
2670
- view: null,
2671
- http: 'http'
2672
- },
2673
-
2674
- initialize: function(){
2675
- if (window.location.toString().indexOf('https') > -1) {
2676
- this.set('http','https');
2677
- }
2678
- this.view = new SidekickWP.Views.User({model: this, el: $("#sidekick ul.sk_bucketContainer div")});
2679
- }
2680
- });
2681
-
2682
- }(jQuery));;(function($) {
2683
- SidekickWP.Views.App = Backbone.View.extend({
2684
-
2685
- initialize: function(){
2686
- SidekickWP.Events.on('open_sidekick_window', this.open_sidekick_window, this);
2687
- SidekickWP.Events.on('close_sidekick_window', this.close_sidekick_window, this);
2688
- SidekickWP.Events.on('open_sidekick_window_and_drawer', this.open_sidekick_window_and_drawer, this);
2689
- SidekickWP.Events.on('toggle_sidekick_drawer', this.toggle_sidekick_drawer, this);
2690
- SidekickWP.Events.on('close_sidekick_drawer', this.close_sidekick_drawer, this);
2691
- SidekickWP.Events.on('open_sidekick_drawer', this.open_sidekick_drawer, this);
2692
- SidekickWP.Events.on('resize_sidekick_drawer', this.resize_sidekick_drawer, this);
2693
- SidekickWP.Events.on('toggle_hotspots', this.toggle_hotspots, this);
2694
- SidekickWP.Events.on('toggle_preferences', this.toggle_preferences, this);
2695
- SidekickWP.Events.on('window_resize', this.check_sidebar_minifiy, this);
2696
- SidekickWP.Events.on('size_drawer', this.size_drawer, this);
2697
- SidekickWP.Events.on('turn_off_composer', this.turn_off_composer, this);
2698
- SidekickWP.Events.on('mode_composer', this.mode_composer, this);
2699
- SidekickWP.Events.on('mode_player', this.mode_player, this);
2700
-
2701
-
2702
-
2703
- Sidekick.Events.on('show_click_warning', this.show_click_warning, this);
2704
- Sidekick.Events.on('track_play', this.check_sidebar_minifiy, this);
2705
- Sidekick.Events.on('track_play', this.close_sidekick_drawer,'hide');
2706
- Sidekick.Events.on('track_stop', this.open_sidekick_drawer);
2707
- Sidekick.Events.on('track_play', this.remove_hotspots,this);
2708
- Sidekick.Events.on('track_stop', this.draw_hotspots,this);
2709
- Sidekick.Events.on('nextStep', this.update_debugger);
2710
- Sidekick.Events.on('preview', this.mode_preview);
2711
-
2712
- return this.render();
2713
- },
2714
-
2715
- render: function(){
2716
- console.groupCollapsed('%crender: SidekickWP: appView %o', 'color:#8fa2ff', this);
2717
-
2718
- var currentDebugMode = $.cookie('sidekick_debug_mode');
2719
- this.model.set('currentDebugMode',currentDebugMode);
2720
-
2721
- this.BucketContainer = new SidekickWP.Models.BucketContainer({
2722
- full_library: this.model.get('full_library'),
2723
- passed_current_page_walkthroughs: this.model.get('passed_current_page_walkthroughs'),
2724
- currentDebugMode: this.model.get('currentDebugMode')
2725
- });
2726
-
2727
- if (_.size(this.model.get('full_library').buckets) > 0) {
2728
- BucketContainer = this.BucketContainer.view.render().$el.html();
2729
- } else {
2730
- BucketContainer = '<div class="warning"><div class="padding">Sorry but there is no walkthroughs found for ' + sk_config.main_soft_name + ' ' + sk_config.main_soft_version + '</div></div>';
2731
- SidekickWP.Events.trigger('show_msg',{title: "No Walkthroughs", msg: "We're sorry but it looks like there are no walkthroughs compatible with your version of software."},this.model);
2732
- }
2733
-
2734
- console.log('BucketContainer %o', BucketContainer);
2735
-
2736
- var composer_state = sessionStorage.getItem("skc_state");
2737
- var composer_mode = false;
2738
- console.log('composer_state %o', composer_state);
2739
-
2740
- if (typeof composer_state !== 'undefined' && composer_state && composer_state !== 'player') {
2741
- composer_mode = true;
2742
- }
2743
- console.log('composer_mode %o', composer_mode);
2744
-
2745
-
2746
- var template = _.template( SidekickWP.Templates.App, {
2747
- composer_mode: composer_mode,
2748
- sidekick_title: (typeof sk_config.sidekick_title !== 'undefined') ? sk_config.sidekick_title : '',
2749
- drawer_title: (typeof sk_config.drawer_title !== 'undefined') ? sk_config.drawer_title : 'Walkthroughs',
2750
- show_powered_by: (typeof sk_config.show_powered_by !== 'undefined') ? sk_config.show_powered_by : '',
2751
- sk_debug: this.model.get('sk_debug'),
2752
- BucketContainer: BucketContainer,
2753
- paid_library: this.model.get('paid_library'),
2754
- hotspots: $.cookie('sidekick_hotspots')
2755
- });
2756
- this.$el.append( template );
2757
-
2758
- if (!this.model.get('show_toggle_feedback'))
2759
- $('#sk_taskbar #toggle_feedback').hide();
2760
-
2761
- SidekickWP.Events.trigger('rendered');
2762
- Sidekick.Events.trigger('bind_controls');
2763
-
2764
- // this.toggle_sidekick_window();
2765
- this.draw_hotspots();
2766
-
2767
- $(document).bind('keypress.sidekickwp',{context: this}, function(e){
2768
- // console.log('e %o', e);
2769
- // console.log('e.keyCode %o', e.keyCode);
2770
-
2771
- if ((e.keyCode == 68 || e.charCode == 68) && e.shiftKey === true) { // shift D
2772
- var currentDebugMode = $.cookie('sidekick_debug_mode');
2773
-
2774
- if (currentDebugMode){
2775
- console.log('DEBUG MODE ON');
2776
- $('.sk_debug').hide();
2777
- $.cookie('sidekick_debug_mode', 0, { expires: 0, path: '/' });
2778
- $.cookie('sidekick_active_walkthrough_current_step_DEBUG', null, { expires: 0, path: '/' });
2779
- } else {
2780
- console.log('DEBUG MODE OFF');
2781
- $('.sk_debug').show();
2782
- $.cookie('sidekick_debug_mode', 1, { expires: 365, path: '/' });
2783
- }
2784
- }
2785
- });
2786
-
2787
- $('.sk_debug input').bind('keyup.sidekickwp',{context: this}, function(e){
2788
- if ($.isNumeric($('.sk_debug input').val())) {
2789
- console.log('Saving Debug Step');
2790
- $.cookie('sidekick_active_walkthrough_current_step_DEBUG', parseInt($('.sk_debug input').val(),10), { expires: 1, path: '/' });
2791
- } else {
2792
- console.log('Clearing Debug Step');
2793
- $.cookie('sidekick_active_walkthrough_current_step_DEBUG', null, { expires: 0, path: '/' });
2794
- }
2795
- });
2796
-
2797
- if (currentDebugMode) {
2798
- var activeStepDEBUG = $.cookie('sidekick_active_walkthrough_current_step_DEBUG');
2799
- if (activeStepDEBUG) {
2800
- $('.sk_debug input').val(activeStepDEBUG);
2801
- }
2802
- $('.sk_debug').show();
2803
- }
2804
-
2805
- if (sk_config.auto_open_root_bucket_id) {
2806
- $('[data-open_bucket="' + sk_config.auto_open_root_bucket_id + '"]').trigger('click');
2807
- }
2808
-
2809
- if (typeof sk_config.sk_composer_button !== 'undefined' && sk_config.sk_composer_button) {
2810
- $('#sidekick').addClass('composer_button_on');
2811
- }
2812
-
2813
- $(window).resize(_.debounce(function(){
2814
- SidekickWP.Events.trigger('resize_sidekick_drawer');
2815
- },500));
2816
-
2817
- $(window).resize(_.debounce(function(){
2818
- SidekickWP.Events.trigger('window_resize');
2819
- },500));
2820
-
2821
- console.groupEnd();
2822
- return this;
2823
- },
2824
-
2825
- events: {
2826
- "click #logo,.sk_toggle": "toggle_sidekick_window",
2827
- "click #toggle_drawer": "toggle_sidekick_drawer",
2828
- "click #toggle_hotspots": "toggle_hotspots",
2829
- "click #toggle_preferences": "toggle_preferences",
2830
- "click #toggle_feedback": "show_feedback",
2831
- "click #toggle_composer": "mode_composer",
2832
- "click #close_sidekick": "close_sidekick_window",
2833
- "click #sk_upgrade button": "screen_activate"
2834
- },
2835
-
2836
- mode_composer: function(){
2837
- console.info('mode_composer');
2838
- this.close_sidekick_window();
2839
- $('div#sidekick').addClass('composer_on').removeClass('drawer_open composer_preview_on');
2840
- Sidekick.Events.trigger('activate_composer');
2841
- console.info('mode_composer2');
2842
- },
2843
-
2844
- mode_player: function(){
2845
- console.info('mode_player');
2846
- SidekickWP.Events.trigger('open_sidekick_window_and_drawer',this);
2847
- $('div#sidekick').removeClass('composer_on').addClass('drawer_open');
2848
- },
2849
-
2850
- mode_preview: function(){
2851
- console.info('mode_preview');
2852
- SidekickWP.Events.trigger('open_sidekick_window',this);
2853
- $('#sidekick').addClass('composer_preview_on').removeClass('drawer_open').removeClass('composer_on');
2854
- },
2855
-
2856
- open_bucket: function(bucket_id){
2857
- this.BucketContainer.view.open_bucket(bucket_id);
2858
- SidekickWP.Events.trigger('open_sidekick_drawer',this);
2859
- },
2860
-
2861
- update_debugger: function(){
2862
- $('#sidekick .step_count').html('Current Step: ' + sidekick.walkthroughModel.get('currentStep') + '/' + _.size(sidekick.walkthroughModel.get('steps')));
2863
- $('#sidekick .step_count').append("&nbsp<a target='_blank' href='http://library.sidekick.pro/wp-admin/post.php?post=" + sidekick.walkthroughModel.get('id') + "&action=edit'>Edit</a>");
2864
- },
2865
-
2866
- screen_activate: function(){
2867
- SidekickWP.Events.trigger('screen_activate');
2868
- },
2869
-
2870
- show_click_warning: function(){
2871
- $('#sidekick #click_warning').remove();
2872
- $('#sidekick #sk_taskbar').append('<div id="click_warning"><h3></h3><span>Clicks are restricted during Walkthroughs. Stop the Walkthrough to navigate normally.</span></div>')
2873
- .find('#click_warning')
2874
- .addClass('show')
2875
- .wait(5000)
2876
- .removeClass('show');
2877
- },
2878
-
2879
- check_sidebar_minifiy: function(){
2880
- var width = $( document ).width();
2881
- var playing = $('#sidekick').hasClass('playing');
2882
- if (width < 784 && playing) {
2883
- $('.sidekick_stop').trigger('click');
2884
- Sidekick.Events.trigger('show_error',9);
2885
- }
2886
-
2887
- if ('body.sticky-menu') {
2888
- $('body').removeClass('sticky-menu');
2889
- $('body').removeClass('auto-fold');
2890
- // $('li#collapse-menu').trigger('click');
2891
- }
2892
- },
2893
-
2894
- goto_config: function(){
2895
- // console.log('goto_config');
2896
- window.open(sk_config.plugin_url,'_self');
2897
- },
2898
-
2899
- show_feedback: function(){
2900
- // console.log('show_feedback');
2901
- // Sidekick.Events.trigger('show_modal',{title:'Feedback',message: 'Send us some feedback!',primary_button_message: 'Send',secondary_button_message:'Cancel',email:sk_config.user_email});
2902
-
2903
- Sidekick.Events.trigger('show_modal',{
2904
- title: 'Feedback',
2905
- // msg: 'Send us some feedback!',
2906
- email: sk_config.user_email,
2907
- height: 340,
2908
-
2909
- button1: {
2910
- title: 'Cancel',
2911
- onclick: "javascript:jQuery(\'#sk_lightbox .close\').trigger(\'click\');javascript:jQuery(\'.sidekick_play_pause\').trigger(\'click\')"
2912
- },
2913
- button2: {
2914
- title: 'Send',
2915
- onclick: "javascript:Sidekick.Events.trigger(\'send_notification\')"
2916
- }
2917
- });
2918
-
2919
- },
2920
-
2921
- resize_sidekick_drawer: function(){
2922
- // console.log('resize_sidekick_drawer %o', $('#sk_drawer').height());
2923
- // console.log('$(#sidekick).hasClass(open) %o', $('div#sidekick').hasClass('open'));
2924
-
2925
- if ($('div#sidekick').hasClass('open')) {
2926
- if ($('#sk_drawer').height() > 0) {
2927
- SidekickWP.Events.trigger('size_drawer');
2928
- }
2929
- } else {
2930
- $('#sk_drawer').height(0);
2931
- }
2932
- },
2933
-
2934
- toggle_preferences: function(){
2935
- window.open(sk_config.plugin_url,'_self');
2936
- },
2937
-
2938
- toggle_sidekick_drawer: function(force){
2939
- // console.log('toggle_sidekick_drawer %o | %o | %o', force,$('#sk_drawer').height(),$('div#sidekick').hasClass('open'));
2940
-
2941
- if ($('#sk_drawer').height() > 0 || force == 'hide' || !$('div#sidekick').hasClass('open')) {
2942
- SidekickWP.Events.trigger('close_sidekick_drawer');
2943
- } else {
2944
- SidekickWP.Events.trigger('open_sidekick_drawer');
2945
- }
2946
- },
2947
-
2948
- open_sidekick_window_and_drawer: function(){
2949
- console.log('open_sidekick_window_and_drawer %o',this);
2950
- this.open_sidekick_window().promise().done(function(){
2951
- SidekickWP.Events.trigger('open_sidekick_drawer');
2952
- },this);
2953
- },
2954
-
2955
- close_sidekick_drawer: function(){
2956
- console.log('Closing Drawer');
2957
- $('div#sidekick').removeClass('drawer_open');
2958
- $('div#sidekick #toggle_drawer').removeClass('on');
2959
- return $('#sk_drawer .sk_bucketContainer,#sk_drawer').css({
2960
- height: 0,
2961
- transition: 'height 0.3s ease-in-out'
2962
- });
2963
- },
2964
-
2965
- open_sidekick_drawer: function(){
2966
- console.log('Open Drawer');
2967
- $('.sk_hotspot').show();
2968
- if ($('#sidekick').hasClass('composer_preview_on') || $('#sidekick').hasClass('composer_on')) {
2969
- console.log("Can't open drawer because composer is on");
2970
- return false;
2971
- }
2972
-
2973
- $('div#sidekick').addClass('drawer_open');
2974
- SidekickWP.Events.trigger('size_drawer');
2975
- },
2976
-
2977
- size_drawer: function(){
2978
- var window_height = $(window).height();
2979
- if (window_height > 900) {
2980
- window_height = 900;
2981
- }
2982
- var sk_drawer_height = window_height - 130;
2983
- var sk_bucketContainer_height = sk_drawer_height - 56;
2984
- // console.log('sk_drawer_height %o', sk_drawer_height);
2985
-
2986
- if ($('#sk_upgrade').length > 0) {
2987
- // console.log('upgrade shorter');
2988
- sk_bucketContainer_height -= $('#sk_upgrade').height();
2989
- }
2990
- // console.log('sk_bucketContainer_height %o', sk_bucketContainer_height);
2991
-
2992
- var sub_bucket_height = sk_bucketContainer_height;
2993
- var sub_bucket_inner_height = sub_bucket_height - 56;
2994
-
2995
- $('div#sidekick').addClass('open');
2996
- $('div#sidekick .sk_caption').removeClass('show');
2997
- $('div#sidekick #toggle_drawer').addClass('on');
2998
- $('#sk_drawer').css({
2999
- height: sk_drawer_height,
3000
- transition: 'height 0.3s ease-in-out'
3001
- });
3002
- $('#sk_drawer .sk_bucketContainer').css({
3003
- height: sk_bucketContainer_height,
3004
- transition: 'height 0.3s ease-in-out'
3005
- });
3006
- $('#sk_drawer .sub_bucket').css({
3007
- maxHeight: sub_bucket_height,
3008
- transition: 'all 0.3s ease-in-out'
3009
- });
3010
-
3011
- $('#sk_drawer .sub_bucket_inner').css({
3012
- height: sub_bucket_inner_height
3013
- });
3014
-
3015
- // console.log('sub_bucket_height %o', sub_bucket_height);
3016
-
3017
-
3018
- this.BucketContainer.set('sk_bucketContainer_height',sk_bucketContainer_height);
3019
- this.BucketContainer.set('sub_bucket_height',sub_bucket_height);
3020
- this.BucketContainer.set('sub_bucket_inner_height',sub_bucket_inner_height);
3021
- },
3022
-
3023
- unblur_buttons: function(){
3024
- $('div#sidekick buttons').blur();
3025
- },
3026
-
3027
- toggle_sidekick_window: function(e){
3028
- this.unblur_buttons();
3029
- console.log('toggle_sidekick_window');
3030
-
3031
- if ($('div#sidekick').hasClass('working')) {
3032
- console.log('Still working can\'t toggle');
3033
- return false;
3034
- }
3035
-
3036
- if ($('div#sidekick').hasClass('open')) {
3037
- this.close_sidekick_drawer().promise().done(function(){
3038
- console.log('close_sidekick_drawer().promise().done');
3039
- SidekickWP.Events.trigger('close_sidekick_window');
3040
- },this);
3041
- } else {
3042
- this.open_sidekick_window_and_drawer();
3043
- }
3044
- },
3045
-
3046
- set_opened_within_last_hour_cookie: function(){
3047
- var date = new Date();
3048
- var minutes = 60;
3049
- date.setTime(date.getTime() + (minutes * 60 * 1000));
3050
- $.cookie("sidekick_opened_within_last_hour", true, { expires: date });
3051
- },
3052
-
3053
- close_sidekick_window: function(e){
3054
- console.log('close_sidekick_window');
3055
- if ($('div#sidekick').hasClass('open')) {
3056
- SidekickWP.Events.trigger('close_sidekick_drawer');
3057
- $('div#sidekick').addClass('working').wait(500,function(e){
3058
- $('div#sidekick').removeClass('working open');
3059
- });
3060
- }
3061
- },
3062
-
3063
- open_sidekick_window: function(e){
3064
- console.log('open_sidekick_window %o',this);
3065
- if (!$('div#sidekick').hasClass('open')) {
3066
- this.set_opened_within_last_hour_cookie();
3067
- SidekickWP.Events.trigger('track_explore',{what:'Sidekick - Open'});
3068
-
3069
- return $('div#sidekick').addClass('working').addClass('open').wait(500,function(e){
3070
- console.log('DONE open_sidekick_window');
3071
- $(this).removeClass('working');
3072
- });
3073
- }
3074
- },
3075
-
3076
- toggle_hotspots: function(){
3077
- console.log('toggle_hotspots');
3078
- if ($('#toggle_hotspots').hasClass('on')) {
3079
- // console.log('Turning off hotspots');
3080
- $('#toggle_hotspots').removeClass('on');
3081
- $.cookie('sidekick_hotspots', 0, { expires: 365, path: '/' });
3082
- $('.sk_hotspot').parent().remove();
3083
- } else {
3084
- // console.log('Turning on hotspots');
3085
- $('#toggle_hotspots').addClass('on');
3086
- $.cookie('sidekick_hotspots', 1, { expires: 365, path: '/' });
3087
- this.draw_hotspots();
3088
- }
3089
- },
3090
-
3091
- remove_hotspots: function(){
3092
- // console.log('remove_hotspots');
3093
-
3094
- this.unbind_hotspot_targets();
3095
- $('.sk_hotspot').parent().remove();
3096
- },
3097
-
3098
- unbind_hotspot_targets: function(){
3099
- // console.log('unbind_hotspot_targets');
3100
- var hotspots = this.model.get('library_filtered_hotspots');
3101
- var url = window.location.toString();
3102
-
3103
- for(var hotspot in hotspots){
3104
- hotspot_data = hotspots[hotspot];
3105
-
3106
- if (url.indexOf(hotspot_data.url) > -1) {
3107
- selectors = hotspot_data.selector;
3108
- $(selectors).off('css-change');
3109
- }
3110
- }
3111
- },
3112
-
3113
- draw_hotspots: function(){
3114
- var hotspots = this.model.get('library_filtered_hotspots');
3115
- console.groupCollapsed('Attaching Hotspots [%o]',hotspots.length);
3116
-
3117
- var url = window.location.toString();
3118
- var show_hotspots = $.cookie('sidekick_hotspots');
3119
- var count = 0;
3120
- var hotspot_data;
3121
- var hotspot;
3122
- var selectors;
3123
-
3124
- console.log('show_hotspots %o', show_hotspots);
3125
- console.log('show_hotspots === true %o', show_hotspots === true);
3126
-
3127
- // Counting Hotspots
3128
- for(hotspot in hotspots){
3129
- hotspot_data = hotspots[hotspot];
3130
-
3131
- if (url.indexOf(hotspot_data.url) > -1) {
3132
- selectors = hotspot_data.selector;
3133
-
3134
- try{
3135
- if ($(selectors).length == 1 && $(selectors).is(':visible')) {
3136
- console.log('hotspot selectors-1 %o', selectors);
3137
- count++;
3138
- } else if ($(selectors).length > 1){
3139
- _.each($(selectors),function(item,key){
3140
- if ($(item).length && $(item).is(':visible')) {
3141
- console.log('hotspot selectors-2 %o', item);
3142
- count++;
3143
- }
3144
- });
3145
- }
3146
- }
3147
- catch(e){
3148
- console.log('%cAttaching Hotspot Catch Error','color: red',arguments);
3149
- console.log('hotspot_data %o', hotspot_data);
3150
-
3151
- }
3152
-
3153
-
3154
- }
3155
- }
3156
-
3157
- if (count > 0) {
3158
- $('div#sidekick #toggle_hotspots').html(count).show();
3159
- } else {
3160
- $('div#sidekick #toggle_hotspots').html(count).hide();
3161
- }
3162
-
3163
- if (show_hotspots === '1' || typeof show_hotspots === 'undefined') { // User unspecified default is on
3164
-
3165
- for(hotspot in hotspots){
3166
-
3167
- var selector_x = 'left';
3168
- var selector_y = 'top';
3169
- var hotspot_x = 'right';
3170
- var hotspot_y = 'top';
3171
- var hotspot_y_padding = '+0';
3172
- var hotspot_x_padding = '+0';
3173
-
3174
- hotspot_data = hotspots[hotspot];
3175
-
3176
- if (url.indexOf(hotspot_data.url) > -1) {
3177
- selectors = hotspot_data.selector;
3178
- if ($(selectors).length == 1) {
3179
-
3180
- var offset = $(selectors).offset();
3181
-
3182
- // selectors = '.add-new-h2';
3183
- $('body').append('<a href="javascript: sidekick.play(' + hotspot_data.id + ')"><div class="sk_hotspot sk_hotspot_' + hotspot + '" data-target="' + selectors + '"></div></a>');
3184
-
3185
- // console.log('%cAttaching Single Hotspot %o[%O] -> (%o [%O])','color: #64c541','sk_hotspot_' + hotspot,$('.sk_hotspot_' + hotspot), selectors,$(selectors));
3186
-
3187
- // console.log('at: selector_x + " " + selector_y %o', selector_x + " " + selector_y);
3188
- // console.log('my: hotspot_x + hotspot_x_padding + " " + hotspot_y + hotspot_y_padding %o', hotspot_x + hotspot_x_padding + " " + hotspot_y + hotspot_y_padding);
3189
-
3190
- $('.sk_hotspot_' + hotspot).position({
3191
- at: selector_x + " " + selector_y,
3192
- my: hotspot_x + hotspot_x_padding + " " + hotspot_y + hotspot_y_padding,
3193
- of: $(selectors)
3194
- })
3195
- //.css({zIndex: $(selectors).css('zIndex')});
3196
-
3197
- $(selectors).data('sk_hotspot','.sk_hotspot_' + hotspot);
3198
-
3199
- $(selectors).csswatch({
3200
- props: 'top,left',
3201
- props_functions: {"top":"offset().top", "left":"offset().left"}
3202
- });
3203
-
3204
- console.log('selectors %o', selectors);
3205
-
3206
-
3207
- $(selectors).on("css-change", function(event, change){
3208
- // console.log('css-change',arguments);
3209
- // console.log('this %o', this);
3210
-
3211
- var selector_x = 'left';
3212
- var selector_y = 'top';
3213
- var hotspot_x = 'right';
3214
- var hotspot_y = 'top';
3215
- var hotspot_y_padding = '+0';
3216
- var hotspot_x_padding = '+0';
3217
-
3218
-
3219
- $($(this).data('sk_hotspot')).position({
3220
- at: selector_x + " " + selector_y,
3221
- my: hotspot_x + hotspot_x_padding + " " + hotspot_y + hotspot_y_padding,
3222
- of: this
3223
- });
3224
- });
3225
-
3226
- $('.sk_hotspot').wait(20*count).addClass('visible');
3227
- } else if ($(selectors).length > 1){
3228
- // console.log('selectors %o', selectors);
3229
-
3230
- _.each($(selectors),function(item,key){
3231
- $('body').append('<a href="javascript: sidekick.play(' + hotspot_data.id + ')"><div class="sk_hotspot sk_hotspot_' + hotspot + '_' + key + '" data-target="' + item + '"></div></a>');
3232
- // console.log('%cAttaching Hotspot #o %o (%o)','color: #64c541',key,'sk_hotspot_' + hotspot + '_' + key, $('.sk_hotspot_' + hotspot + '_' + key));
3233
-
3234
- $('.sk_hotspot_' + hotspot + '_' + key).position({
3235
- at: selector_x + " " + selector_y,
3236
- my: hotspot_x + hotspot_x_padding + " " + hotspot_y + hotspot_y_padding,
3237
- of: item
3238
- })
3239
- //.css({zIndex: $(item).css('zIndex')});
3240
-
3241
- $('.sk_hotspot').wait(20*count).addClass('visible');
3242
- });
3243
- } else {
3244
- console.log("%cCouldn't attach a hotspot to selector (" + selectors + ")",'color: red');
3245
- // Sidekick.Events.trigger('track_error',{model: this, msg: msg});
3246
- // console.error(msg + ' %o',hotspot_data);
3247
- }
3248
- }
3249
- }
3250
- };
3251
- console.groupEnd();
3252
- }
3253
- });
3254
-
3255
- }(jQuery));
3256
-
3257
-
3258
-
3259
- ;(function($) {
3260
- SidekickWP.Views.BucketContainer = Backbone.View.extend({
3261
-
3262
- initialize: function(models,options){
3263
- SidekickWP.Events.on('rendered', this.setup_events, this);
3264
- return this;
3265
- },
3266
-
3267
- render: function(){
3268
- console.group('%crender: render: bucketContainerView %o', 'color:#8fa2ff', this);
3269
-
3270
- this.bucket = new SidekickWP.Models.Bucket({
3271
- title: this.model.get('title'),
3272
- full_library: this.model.get('full_library'),
3273
- passed_current_page_walkthroughs: this.model.get('passed_current_page_walkthroughs'),
3274
- bucket: this.open_bucket(0,true)
3275
- });
3276
- this.$el.append(this.bucket.view.render().el);
3277
-
3278
- console.groupEnd();
3279
- return this;
3280
- },
3281
-
3282
- clicked_bucket: function(e){
3283
- // console.log('clicked_bucket',e);
3284
-
3285
- var old_bucket_direction = 'pull_left';
3286
- var new_bucket_direction = 'pull_right';
3287
-
3288
- if ($(e).hasClass('goprev')) {
3289
- old_bucket_direction = 'pull_right';
3290
- new_bucket_direction = 'pull_left';
3291
- }
3292
-
3293
- $('.sk_bucketContainer>div>ul').addClass(old_bucket_direction).wait(500).remove();
3294
-
3295
- var bucket_data = this.model.find_bucket($(e).data('open_bucket'));
3296
- bucket_data.new_bucket_direction = new_bucket_direction;
3297
- bucket_data.currentDebugMode = this.model.get('currentDebugMode');
3298
-
3299
- if (_.size(bucket_data.bucket.walkthroughs) > 0) {
3300
- template = _.template( SidekickWP.Templates.WalkthroughsNew, bucket_data);
3301
- } else {
3302
- template = _.template( SidekickWP.Templates.BucketNew, bucket_data);
3303
- }
3304
- $('.sk_bucketContainer>div').append(template)
3305
- .find('.' + new_bucket_direction)
3306
- .wait(10)
3307
- .removeClass(new_bucket_direction);
3308
-
3309
- SidekickWP.Events.trigger('track_explore',{what:'Bucket - ' + $('span',e).html(), id: $(e).data('open_bucket') });
3310
-
3311
- this.reset_bucket_dimentions();
3312
- this.setup_events();
3313
- },
3314
-
3315
- reset_bucket_dimentions: function(){
3316
- $('.sk_bucketContainer')
3317
- .height(this.model.get('sk_bucketContainer_height'))
3318
- .find('.sub_bucket')
3319
- .height(this.model.get('sub_bucket_height'))
3320
- .find('.sub_bucket_inner')
3321
- .height(this.model.get('sub_bucket_inner_height'));
3322
- },
3323
-
3324
- find_bucket_by_id: function(data,key,match){
3325
- if (data[key] == match) {
3326
- console.log('%cfound %o','color: green',data);
3327
- return data;
3328
- }
3329
-
3330
- if (_.size(data.sub_buckets) > 0 ) {
3331
- for (var sub_bucket in data.sub_buckets){
3332
- var found = this.find_bucket_by_id(data.sub_buckets[sub_bucket],key,match);
3333
- if (found) {
3334
- return found;
3335
- }
3336
- }
3337
- } else {
3338
- console.log('%cnot found','color: red');
3339
- return;
3340
- }
3341
- },
3342
-
3343
- find_bucket_by_id_rec: function(data,key,match){
3344
- for (var sub_bucket in data){
3345
- var result = this.find_bucket_by_id(data[sub_bucket],key,match);
3346
- if (result) {
3347
- return result;
3348
- }
3349
- }
3350
- return false;
3351
- },
3352
-
3353
- open_bucket: function(bucket_id, return_data){
3354
- console.log('open_bucket %o', bucket_id);
3355
-
3356
- var template;
3357
- var bucket_data = this.model.find_bucket(bucket_id);
3358
- bucket_data.new_bucket_direction = '';
3359
- bucket_data.currentDebugMode = this.model.get('currentDebugMode');
3360
-
3361
- if (bucket_data) {
3362
- console.log('bucket_data %o', bucket_data);
3363
- $('.sk_bucketContainer>div').html('');
3364
-
3365
- if (_.size(bucket_data.bucket.walkthroughs) > 0) {
3366
- template = _.template( SidekickWP.Templates.WalkthroughsNew, bucket_data);
3367
- } else {
3368
- template = _.template( SidekickWP.Templates.BucketNew, bucket_data);
3369
- }
3370
-
3371
- if (return_data) {
3372
- return template;
3373
- }
3374
-
3375
- $('.sk_bucketContainer>div').append(template);
3376
- this.reset_bucket_dimentions();
3377
- } else {
3378
- console.error('Bucket Doesn\'t exist');
3379
- }
3380
- this.setup_events();
3381
- },
3382
-
3383
- draw_bucket: function(bucket_id){
3384
- console.info('draw_bucket %o', bucket_id);
3385
- var full_library = this.model.get('full_library');
3386
- var bucket_data = this.find_bucket_by_id_rec(full_library.buckets,'id',bucket_id);
3387
-
3388
- var variables = {
3389
- bucket_id: bucket_id,
3390
- bucket_title: bucket_data.post_title,
3391
- bucket_data: bucket_data,
3392
- full_library: full_library
3393
- };
3394
- var template = _.template( SidekickWP.Templates.SubBucket, variables );
3395
- $('.sk_bucketContainer>div').append(template);
3396
- },
3397
-
3398
- draw_walkthroughs: function(bucket_id){
3399
- console.log('draw_walkthroughs %o', bucket_id);
3400
-
3401
- var full_library = this.model.get('full_library');
3402
- var bucket_data = this.find_bucket_by_id_rec(full_library.buckets,'id',bucket_id);
3403
-
3404
- var variables = {
3405
- bucket_id: bucket_id,
3406
- bucket_data: bucket_data,
3407
- full_library: full_library
3408
- };
3409
-
3410
- var template = _.template( SidekickWP.Templates.Walkthroughs, variables );
3411
- $('.sk_bucketContainer>div').append(template);
3412
- },
3413
-
3414
- setup_events: function(){
3415
-
3416
- $('[data-open_bucket],[data-open_walkthroughs],.goprev,.sub_bucket_heading').unbind('click').click({context:this},function(e){
3417
- e.data.context.clicked_bucket(this);
3418
- });
3419
-
3420
- $('a.sidekick_play_walkthrough').unbind('click').click({context:this},function(e){
3421
- SidekickWP.Events.trigger('close_sidekick_window');
3422
- });
3423
-
3424
- $('.walkthroughs_inner .edit').click(function(e){
3425
- e.preventDefault();
3426
- e.stopPropagation();
3427
- var id = $(this).data('id');
3428
- window.open("http://library.sidekick.pro/wp-admin/post.php?post=" + id + "&action=edit","_blank");
3429
- });
3430
-
3431
-
3432
- // SidekickWP.Helpers.preventScrolling();
3433
- }
3434
- });
3435
-
3436
- }(jQuery));
3437
-
3438
- ;(function($) {
3439
- SidekickWP.Views.Bucket = Backbone.View.extend({
3440
-
3441
- initialize: function(models,options){
3442
- return this;
3443
- },
3444
-
3445
- render: function(){
3446
- // console.group('%crender: render: bucketView %o', 'color:#8fa2ff', this);
3447
-
3448
- var variables = {
3449
- full_library: this.model.get('full_library'),
3450
- passed_current_page_walkthroughs: this.model.get('passed_current_page_walkthroughs')
3451
- };
3452
-
3453
- console.log('SidekickWP.Templates.Bucket variables %o', variables);
3454
-
3455
- var template = _.template( SidekickWP.Templates.Bucket, variables );
3456
- this.$el.append(template);
3457
- // console.groupEnd();
3458
- return this;
3459
- }
3460
- });
3461
-
3462
- }(jQuery));;(function($) {
3463
- SidekickWP.Views.Message = Backbone.View.extend({
3464
-
3465
- initialize: function(models,options){
3466
- console.group('%crender: render: messageView %o', 'color:#8fa2ff', this);
3467
- this.render();
3468
- console.groupEnd();
3469
- return this;
3470
- },
3471
-
3472
- render: function(){
3473
-
3474
- var variables = {
3475
- title: this.model.get('title'),
3476
- message: this.model.get('message')
3477
- };
3478
-
3479
- var template = _.template( SidekickWP.Templates.Message, variables );
3480
-
3481
- this.$el.append( template );
3482
- // SidekickWP.Helpers.preventScrolling();
3483
- // SidekickWP.Events.trigger('show_next_pane');
3484
-
3485
- // $('div#sidekick .prev_window').removeClass('prev_window');
3486
- // $('div#sidekick #main_menu').addClass('prev_window');
3487
- // $('div#sidekick ul.main>li').not('#main_menu,#review').remove();
3488
-
3489
- return this;
3490
- }
3491
-
3492
- });
3493
-
3494
- }(jQuery));;(function($) {
3495
- SidekickWP.Views.Review = Backbone.View.extend({
3496
-
3497
- initialize: function(models,options){
3498
- console.group('%cinitialize: Core View %o', 'color:#3b4580', arguments);
3499
- this.render();
3500
- this.setup_events();
3501
- console.groupEnd();
3502
- return this;
3503
- },
3504
-
3505
- render: function(){
3506
- console.group('%crender: render: renderView %o', 'color:#8fa2ff', this);
3507
- console.log('SidekickWP.Templates.Review %o', SidekickWP.Templates.Review);
3508
-
3509
- var variables = {
3510
- title: 'How did we do?'
3511
- };
3512
-
3513
- var template = _.template( SidekickWP.Templates.Review, variables );
3514
- console.log('template %o', template);
3515
-
3516
- this.$el.append( template );
3517
- // SidekickWP.Helpers.preventScrolling();
3518
- // SidekickWP.Events.trigger('show_next_pane');
3519
-
3520
- // $('div#sidekick .prev_window').removeClass('prev_window');
3521
- // $('div#sidekick #main_menu').addClass('prev_window');
3522
- // $('div#sidekick ul.main>li').not('#main_menu,#review').remove();
3523
-
3524
- return this;
3525
- },
3526
-
3527
- events: {
3528
- "click input[type='submit']": "submit",
3529
- "click div.rate span": "rate"
3530
- },
3531
-
3532
- setup_events: function(){
3533
- var group_id = this.model.get('id');
3534
-
3535
- $('div#sidekick .review h2 button.goback, #sidekick .review input[type="button"]').unbind('click').click({context:this},function(e){
3536
- console.log('click goback/button');
3537
- SidekickWP.Events.trigger('show_main_pane');
3538
- });
3539
-
3540
- $('div#sidekick .review .rate span').unbind('hover').hover(function(){
3541
- $(this).addClass('hover')
3542
- .prevAll().addClass('hover');
3543
- },function(){
3544
- $('div#sidekick .review .rate span').removeClass('hover');
3545
- });
3546
-
3547
- $('div#sidekick .review .rate span').unbind('click').click = this.rate;
3548
-
3549
- $('div#sidekick .review textarea').unbind('click').click(function(){
3550
- if(!$(this).hasClass('clicked')){
3551
- $(this).addClass('clicked')
3552
- .val('');
3553
- }
3554
- });
3555
- },
3556
-
3557
- submit: function(){
3558
- var data = {
3559
- walkthrough_title: this.model.get('walkthrough_title'),
3560
- value: $('div#sidekick textarea[name="comment"]').val(),
3561
- license: sk_config.license_key
3562
- };
3563
-
3564
- var http = 'http';
3565
- if (window.location.toString().indexOf('https') > -1) {
3566
- http = 'https';
3567
- }
3568
-
3569
- $.ajax({
3570
- url: http + '://library.sidekick.pro/wp-admin/admin-ajax.php?action=wpu_add_comment',
3571
- context: this,
3572
- data: data,
3573
- dataType: 'json'
3574
- }).done(function(data,e){
3575
- console.log('Saved Comment');
3576
- $('div#sidekick textarea').html('Thank You!');
3577
- $('div#sidekick .review input[type="submit"]').val('Sent!');
3578
- setTimeout(SidekickWP.Events.trigger('show_main_pane'),3000);
3579
- }).error(function(e){
3580
- console.error('Comment Save error (%o)',e);
3581
- });
3582
- },
3583
-
3584
- rate: function(e){
3585
- var data = {
3586
- walkthrough_title: this.model.get('walkthrough_title'),
3587
- rating: $(e.currentTarget).data('val'),
3588
- license: sk_config.license_key
3589
- };
3590
-
3591
- $(e.currentTarget).addClass('saved')
3592
- .prevAll().addClass('saved');
3593
-
3594
- $('div#sidekick .rate span').unbind('mouseenter mouseleave click').css({cursor: 'default'});
3595
-
3596
- var http = 'http';
3597
- if (window.location.toString().indexOf('https') > -1) {
3598
- http = 'https';
3599
- }
3600
-
3601
- $.ajax({
3602
- url: http + '://library.sidekick.pro/wp-admin/admin-ajax.php?action=wpu_add_rating',
3603
- context: this,
3604
- data: data,
3605
- dataType: 'json'
3606
- }).done(function(data,e){
3607
- console.log('Saved Rating');
3608
- $('div#sidekick .hover').addClass('saved');
3609
-
3610
- }).error(function(e){
3611
- console.error('Rating Save error (%o)',e);
3612
- });
3613
-
3614
- }
3615
-
3616
- });
3617
-
3618
- }(jQuery));;SidekickWP.Templates.App = [
3619
- "<div id='sidekick' class='sidekick_player <% if(composer_mode){ %>composer_on<% } %>'>",
3620
- "<div id='sk_taskbar'>",
3621
- "<div id='logo'><% print(sidekick_title) %></div>",
3622
- "<button class='sk_toggle'></button>",
3623
- "<div class='sk_controls'>",
3624
- "<button class='sidekick_restart'></button>",
3625
- "<button class='sidekick_play_pause'></button>",
3626
- "<button class='sidekick_stop'></button>",
3627
- "</div>",
3628
- "<div class='sk_debug'>",
3629
- "<div class='step_count'></div>",
3630
- "<input type='text' name='step' placeholder='Force Step'></input>",
3631
- "<div class=''>Skip Step <br/>Press ></div>",
3632
- "</div>",
3633
-
3634
- "<div class='sk_toggles'>",
3635
- // "<% console.log('hotspots %o',hotspots);%>",
3636
- "<button id='toggle_hotspots' <% if (hotspots === '1' || typeof hotspots === 'undefined'){%>class='on'<% } %> alt='Number of hotspots'>0</button>",
3637
- "<button id='toggle_composer'></button>",
3638
- "<button id='toggle_feedback'></button>",
3639
- "<button id='toggle_preferences'></button>",
3640
- "<button id='toggle_drawer'><i></i></button>",
3641
- "</div>",
3642
- "<% if (show_powered_by){ %>",
3643
- "<div class='sk_powered_by'>Powered by SIDEKICK.pro</div>",
3644
- "<% } %>",
3645
- "<div class='sk_info'>",
3646
- "<div class='sk_title'><label>Now Playing</label><span class='sk_walkthrough_title'></span></div>",
3647
- "<div class='sk_divider'></div>",
3648
- "<div class='sk_time'>0:00/0:00</div>",
3649
- "</div>",
3650
- "<div class='sk_caption'>",
3651
- "<div class='text'></div>",
3652
- "</div>",
3653
- "</div>",
3654
- "<div id='sk_drawer'>",
3655
- "<h2><span><% print(drawer_title) %></span><button id='close_sidekick'></button></h2>",
3656
- "<ul class='sk_bucketContainer'>",
3657
- "<% print(BucketContainer) %>",
3658
- "<% if(typeof paid_library === 'undefined' || paid_library == null || _.size(paid_library.buckets) == 0){ %>",
3659
- "<ul id='sk_upgrade'><li><button>Upgrade SIDEKICK!</button></li></ul>",
3660
- "<% } %>",
3661
- "</ul>",
3662
- "</div>",
3663
- "</div>"
3664
- ].join("");
3665
-
3666
- SidekickWP.Templates.Bucket = [
3667
- "<ul class='buckets show' data-bucket_id='buckets'>",
3668
- "<% _.each(full_library.buckets, function(bucket_data, bucket_title){ %>",
3669
- "<li class='heading bucket_heading' <% if (bucket_data.sub_buckets){ %> data-open_bucket='<% print(bucket_data.id) %>' <% } else { %> data-open_walkthroughs='<% print(bucket_data.id) %>' <% } %> ><span><% print(bucket_title) %></span><i></i></li>",
3670
- "<% }); %>",
3671
- "<% if (_.size(passed_current_page_walkthroughs) > 0){ %>",
3672
- "<li class='heading bucket_heading related_walkthroughs_heading'><span>Related Walkthrough(s)</span></li>",
3673
- "<li>",
3674
- "<ul class='walkthroughs'>",
3675
- "<ul class='walkthrough current_page_walkthroughs'>",
3676
-
3677
- "<ul class='walkthroughs_inner'>",
3678
-
3679
- "<% var first_drawn = false; %>",
3680
- "<% _.each(passed_current_page_walkthroughs, function(walkthrough){ %>",
3681
- "<% if (walkthrough.type == 'overview'){ %>",
3682
- "<% if (!first_drawn){ %>",
3683
- "<% if (_.size(passed_current_page_walkthroughs) > 1){ %>",
3684
- "<li class='sub_heading'><span>Overviews</span></li>",
3685
- "<% } else{ %>",
3686
- "<li class='sub_heading'><span>Overview</span></li>",
3687
- "<% } %>",
3688
- "<% first_drawn = true %>",
3689
- "<% } %>",
3690
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='overview <% if (walkthrough.subscribed){ %>subscribed<% } %>'><span><% print(walkthrough.title) %></span></li></a>",
3691
- "<% } %>",
3692
- "<% }); %>",
3693
- "<% var first_drawn = false; %>",
3694
- "<% _.each(passed_current_page_walkthroughs, function(walkthrough){ %>",
3695
- "<% if (walkthrough.type == 'how'){ %>",
3696
- "<% if (!first_drawn){ %>",
3697
- "<% if (_.size(passed_current_page_walkthroughs) > 1){ %>",
3698
- "<li class='sub_heading'><span>How Do I...</span></li>",
3699
- "<% } else{ %>",
3700
- "<li class='sub_heading'><span>How Do I...</span></li>",
3701
- "<% } %>",
3702
- "<% first_drawn = true %>",
3703
- "<% } %>",
3704
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='how <% if (walkthrough.subscribed){ %>subscribed<% } %>'><span><% print(walkthrough.title) %></span></li></a>",
3705
- "<% } %>",
3706
- "<% }); %>",
3707
- "</ul>",
3708
- "</ul>",
3709
- "</ul>",
3710
- "</li>",
3711
-
3712
-
3713
- "<% } %>",
3714
- "</ul>"
3715
- ].join("");
3716
-
3717
- SidekickWP.Templates.BucketNew = [
3718
- "<ul class='sub_buckets <% print(new_bucket_direction) %>'>",
3719
- "<ul class='sub_bucket' data-bucket_id='<% print(bucket.bucket_id) %>'>",
3720
- "<% if(parent.id){ %>",
3721
- "<li class='heading goprev' data-open_bucket='<% print(parent.id) %>'><span><% print(parent.post_title) %></span><i></i></li>",
3722
- "<% } else if (bucket.id) { %>",
3723
- "<li class='heading goprev' data-open_bucket='<% print(0) %>'><span><% print(bucket.post_title) %></span><i></i></li>",
3724
- "<% } %>",
3725
- "<ul class='sub_bucket_inner'>",
3726
-
3727
- "<% var loop_data = (typeof bucket.walkthroughs !== 'undefined') ? bucket.walkthroughs : bucket.sub_buckets; %>",
3728
-
3729
- "<% for (var item in loop_data){ %>",
3730
- "<% item_data = loop_data[item] %>",
3731
- "<li class='heading sub_bucket_heading' data-open_bucket='<% print(item_data.id) %>'><span><% print(item_data.post_title) %></span><i></i></li>",
3732
- "<% }; %>",
3733
-
3734
- "</ul>",
3735
- "</ul>",
3736
- "</ul>"
3737
- ].join("");
3738
-
3739
- SidekickWP.Templates.SubBucket = [
3740
- "<ul class='sub_buckets'>",
3741
- "<ul class='sub_bucket' data-bucket_id='<% print(bucket_id) %>'>",
3742
- "<li class='heading goprev'><span><% print(bucket_title) %></span><i></i></li>",
3743
- "<ul class='sub_bucket_inner'>",
3744
- "<% for (sub_bucket_data in bucket_data.sub_buckets){ %>",
3745
- "<% sub_bucket_data = bucket_data.sub_buckets[sub_bucket_data] %>",
3746
- "<% if (_.size(sub_bucket_data.sub_buckets) > 0){ %>",
3747
- "<li class='heading sub_bucket_heading' data-open_bucket='<% print(sub_bucket_data.id) %>'><span><% print(sub_bucket_data.post_title) %></span><i></i></li>",
3748
- "<% } else { %>",
3749
- "<li class='heading sub_bucket_heading' data-open_walkthroughs='<% print(sub_bucket_data.id) %>' ><span><% print(sub_bucket_data.post_title) %></span><i></i></li>",
3750
- "<% } %>",
3751
- "<% }; %>",
3752
- "</ul>",
3753
- "</ul>",
3754
- "</ul>"
3755
- ].join("");
3756
-
3757
- SidekickWP.Templates.User = [
3758
- "<% if (view == 'login') { %>",
3759
- "<ul class='user login'>",
3760
- "<li class='heading goprev'><span>Account</span><i></i></li>",
3761
- "<li>",
3762
- "<form id='login' action='<% print(http) %>://library.sidekick.pro/api/user/' method='GET'>",
3763
- "<div>",
3764
- "<label>E-Mail</label><input type='text' name='user_email'/>",
3765
- "<label>Password</label><input type='password' name='password'/>",
3766
- "<a target='_blank' href='/wp-login.php?action=lostpassword'>Forgot Password</a>",
3767
- "<div id='buttons'>",
3768
- "<input type='submit' value='Login'/>",
3769
- "<input type='button' value='Register'/>",
3770
- "</div>",
3771
- "</div>",
3772
- "</form>",
3773
- "</li>",
3774
- "</ul>",
3775
- "<% } else if(view == 'activate') { %>",
3776
- "<ul class='user activate'>",
3777
- "<li class='heading goprev'><span>Activate</span><i></i></li>",
3778
- "<li>",
3779
- // "<form action='<% print(http) %>://library.sidekick.pro/api/user/' method='POST'>",
3780
- "<div id='content'>",
3781
- "<div class='padder'>",
3782
- "<h3>SIDEKICK premium get's you all core walkthroughs</h3>",
3783
- "<a href='<% print(http) %>://www.sidekick.pro/wordpress/modules/wordpress-core-module-premium/' target='_blank'><button>BUY<span>$10 Per Month</span></button></a>",
3784
- // "<div>OR</div>",
3785
- "<br/><label>Enter Activation ID</label><input placeholder='<% print(activation_id) %>' type='text' name='activation_id'/>",
3786
- "<div id='buttons'>",
3787
- "<input type='submit' name='Activate' value='Activate' />",
3788
- "<input type='button' name='Cancel' value='Cancel' />",
3789
- "</div>",
3790
- "</div>",
3791
- "<div id='benefits'>",
3792
- "<h3>Benefits of premium</h3>",
3793
- "<ul>",
3794
- "<li id='more'>",
3795
- "<i></i><h4>More Walkthroughs</h4><p>Get our full WordPress Core library of over 150 walkthroughs.</p>",
3796
- "</li>",
3797
- "<li id='types'>",
3798
- "<i></i><h4>Hotspots & Overviews</h4><p>Gain in depth knowledge and quick hints.</p>",
3799
- "</li>",
3800
- "</ul>",
3801
- "</div>",
3802
- "</div>",
3803
- // "</form>",
3804
- "</li>",
3805
- "</ul>",
3806
- "<% } else if(view == 'register') { %>",
3807
- "<ul class='user register'>",
3808
- "<li class='heading goprev'><span>Register</span><i></i></li>",
3809
- "<li>",
3810
- "<form action='<% print(http) %>://library.sidekick.pro/api/user/' method='POST'>",
3811
- "<label>First Name</label><input type='text' name='first_name'/>",
3812
- "<label>E-Mail</label><input type='text' name='user_email'/>",
3813
- "<label>Password</label><input type='password' name='password'/>",
3814
- "<label>Confirm Password</label><input type='password' name='password2'/>",
3815
- "<label>Coupon</label><input type='text' name='coupon'/>",
3816
- "<input type='button' name='Cancel'/>",
3817
- "<input type='submit' name='Register'/>",
3818
- "</form>",
3819
- "</li>",
3820
- "</ul>",
3821
- "<% } else if(view == 'profile') { %>",
3822
- "<ul class='user profile'>",
3823
- "<li class='heading goprev'><span>Profile</span><i></i></li>",
3824
- "<li>",
3825
- "<form action=''>",
3826
- "<label>Coupon</label><input type='text' name='coupon'/>",
3827
- "<input type='button' name='Cancel'/>",
3828
- "<input type='submit' name='Register'/>",
3829
- "</form>",
3830
- "</li>",
3831
- "</ul>",
3832
- "<% } %>"
3833
- ].join("");
3834
-
3835
-
3836
- SidekickWP.Templates.WalkthroughsNew = [
3837
- "<ul class='walkthroughs <% print(new_bucket_direction) %>'>",
3838
- "<ul class='walkthrough' data-bucket_id='<% print(bucket.id) %>'>",
3839
- "<li class='heading goprev' data-open_bucket='<% print(parent.id) %>'><span><% print(bucket.post_title) %></span><i></i></li>",
3840
- "<ul class='walkthroughs_inner'>",
3841
- "<% var first_drawn = false; %>",
3842
- "<% _.each(bucket.walkthroughs, function(walkthrough, walkthrough_key){ %>",
3843
- "<% if (walkthrough.type == 'overview'){ %>",
3844
- "<% if (!first_drawn){ %>",
3845
- "<li class='sub_heading'><span>Overviews</span></li>",
3846
- "<% first_drawn = true %>",
3847
- "<% } %>",
3848
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='overview <% if (walkthrough.subscribed){ %>subscribed<% } %>'>",
3849
- "<span><% print(walkthrough.title) %><% if (currentDebugMode === '1'){ %><div class='edit' data-id='<% print(walkthrough.id) %>'>&nbsp;[ EDIT ]</div><%}%></span>",
3850
- "</li></a>",
3851
- "<% } %>",
3852
- "<% }); %>",
3853
- "<% var first_drawn = false; %>",
3854
- "<% _.each(bucket.walkthroughs, function(walkthrough, walkthrough_key){ %>",
3855
- "<% if (walkthrough.type == 'how'){ %>",
3856
- "<% if (!first_drawn){ %>",
3857
- "<li class='sub_heading'><span>How Do I...</span></li>",
3858
- "<% first_drawn = true %>",
3859
- "<% } %>",
3860
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='how <% if (walkthrough.subscribed){ %>subscribed<% } %>'>",
3861
- "<span><% print(walkthrough.title) %><% if (currentDebugMode === '1'){ %><div class='edit' data-id='<% print(walkthrough.id) %>'>&nbsp;[ EDIT ]</div><%}%></span>",
3862
- "</li></a>",
3863
- "<% } %>",
3864
- "<% }); %>",
3865
- "</ul>",
3866
- "</ul>",
3867
- "</ul>"
3868
- ].join("");
3869
-
3870
- SidekickWP.Templates.Walkthroughs = [
3871
- "<ul class='walkthroughs'>",
3872
- "<ul class='walkthrough' data-bucket_id='<% print(bucket_id) %>'>",
3873
- "<li class='heading goprev'><span><% print(bucket_data.post_title) %></span><i></i></li>",
3874
- "<ul class='walkthroughs_inner' data-bucket_id='<% print(bucket_id) %>'>",
3875
- "<% var first_drawn = false; %>",
3876
- "<% _.each(bucket_data.walkthroughs, function(walkthrough, walkthrough_key){ %>",
3877
- "<% if (walkthrough.type == 'overview'){ %>",
3878
- "<% if (!first_drawn){ %>",
3879
- "<% if (_.size(bucket_data.walkthroughs) > 1){ %>",
3880
- "<li class='sub_heading'><span>Overviews</span></li>",
3881
- "<% } else{ %>",
3882
- "<li class='sub_heading'><span>Overview</span></li>",
3883
- "<% } %>",
3884
- "<% first_drawn = true %>",
3885
- "<% } %>",
3886
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='overview <% if (walkthrough.subscribed){ %>subscribed<% } %>'><span><% print(walkthrough.title) %></span></li></a>",
3887
- "<% } %>",
3888
- "<% }); %>",
3889
- "<% var first_drawn = false; %>",
3890
- "<% _.each(bucket_data.walkthroughs, function(walkthrough, walkthrough_key){ %>",
3891
- "<% if (walkthrough.type == 'how'){ %>",
3892
- "<% if (!first_drawn){ %>",
3893
- "<% if (_.size(bucket_data.walkthroughs) > 1){ %>",
3894
- "<li class='sub_heading'><span>How Do I...</span></li>",
3895
- "<% } else{ %>",
3896
- "<li class='sub_heading'><span>How Do I...</span></li>",
3897
- "<% } %>",
3898
- "<% first_drawn = true %>",
3899
- "<% } %>",
3900
- "<a href='javascript: <% if (walkthrough.subscribed) { %> sidekick.play(<% print(walkthrough.id) %>) <% } else { %> sidekick.upgrade(\"<% print(walkthrough.id) %>\",\"<% print(walkthrough.title) %>\") <% } %>'><li class='how <% if (walkthrough.subscribed){ %>subscribed<% } %>'><span><% print(walkthrough.title) %></span></li></a>",
3901
- "<% } %>",
3902
- "<% }); %>",
3903
- "</ul>",
3904
- "</ul>",
3905
- "</ul>"
3906
- ].join("");
3907
-
3908
- SidekickWP.Templates.Review = [
3909
- "<ul class='new_window review' data-title='<% print(title) %>'>",
3910
- "<li>",
3911
- "<div><div class='rate'><span data-val='1' class='rate1'></span><span data-val='2' class='rate2'></span><span data-val='3' class='rate3'></span><span data-val='4' class='rate4'></span><span data-val='5' class='rate5'></span></div>",
3912
- "<textarea name='comment'>Let us know if you found the Walkthrough helpful or if we can improve something.</textarea>",
3913
- "<br/><input type='button' value='Skip'></input><input type='submit' value='Submit'></input>",
3914
- "</li>",
3915
- "</ul>"
3916
- ].join("");
3917
-
3918
-
3919
- SidekickWP.Templates.Message = [
3920
- "<ul class='new_window message' data-title='<% print(title) %>'>",
3921
- "<li>",
3922
- "<div><% print(message) %></div>",
3923
- "</li>",
3924
- "</ul>"
3925
- ].join("");
3926
-
3927
- ;(function($) {
3928
- SidekickWP.Views.User = Backbone.View.extend({
3929
-
3930
- initialize: function(models,options){
3931
- console.group('%cinitialize: User View %o', 'color:#3b4580', arguments);
3932
- this.render();
3933
- this.setup_events();
3934
- console.groupEnd();
3935
- return this;
3936
- },
3937
-
3938
- render: function(){
3939
- console.group('%crender: User View %o', 'color:#8fa2ff', this);
3940
-
3941
- var template = _.template( SidekickWP.Templates.User, this.model.attributes );
3942
- console.log('this.$el %o', this.$el);
3943
- console.log('template %o', template);
3944
-
3945
- $('> *',this.$el).addClass('hide');
3946
-
3947
- this.$el.append( template );
3948
- return this;
3949
- },
3950
-
3951
- events: {
3952
- },
3953
-
3954
- close_profile: function(){
3955
- $('ul.sk_bucketContainer ul.user').addClass('hide').wait(1000).remove();
3956
- $('ul.sk_bucketContainer ul.buckets').removeClass('hide');
3957
- },
3958
-
3959
- setup_events: function(){
3960
- // this.setup_login();
3961
-
3962
- $('.heading',$('ul.sk_bucketContainer ul.user')).unbind('click').click({context:this},function(e){
3963
- e.data.context.close_profile(this);
3964
- });
3965
-
3966
- $('#sidekick ul.activate input[name="Cancel"]').unbind('click').click({context:this},function(e){
3967
- console.log('click');
3968
- e.data.context.close_profile(this);
3969
- });
3970
-
3971
- $('#sidekick ul.activate input[type="submit"]').click(function(){
3972
- var input = $('ul.activate input[name="activation_id"]');
3973
-
3974
- if ($(input).val() === '') {
3975
- $(input).addClass('error');
3976
- } else {
3977
- $.post(ajaxurl, {action: 'sk_activate', activation_id: $(input).val()}, function(e){
3978
- console.log('%cBack %o','background-color: yellow; color: black;',e);
3979
- if (e.error == 404) {
3980
- $(input).addClass('error').val("Activation ID Not Valid");
3981
- } else if (e.success) {
3982
- $(input).addClass('success').val("Successful... loading...");
3983
- location.reload();
3984
- }
3985
- },'json');
3986
- }
3987
- });
3988
- }
3989
-
3990
- // setup_login: function(){
3991
- // $('#sidekick .login form').data('view',this);
3992
- // $('#sidekick .login form').submit(function(e){
3993
- // e.preventDefault();
3994
-
3995
- // var request = $.ajax({
3996
- // // url: "http://library.sidekick.pro/api/login/",
3997
- // url: "http://local.library.sidekick.pro/api/login/",
3998
- // data: {
3999
- // 'user_email' : $('#sidekick .login form input[name="user_email"]').val(),
4000
- // 'password' : $('#sidekick .login form input[name="password"]').val()
4001
- // },
4002
- // dataType: "jsonp",
4003
- // context: { view: $(this).data('view')}
4004
- // },this).done(function(e){
4005
- // this.view.login_callback(e,this.view);
4006
- // });
4007
- // });
4008
- // },
4009
-
4010
- // login_callback: function(result,view){
4011
- // console.log('%clogin_callback','color: white;background-color: green');
4012
- // console.log('result %o', result);
4013
- // if (result.token) {
4014
- // $.cookie('sk_token', result.token);
4015
- // new SidekickWP.Models.User({
4016
- // 'view' : 'activate'
4017
- // });
4018
- // }
4019
- // }
4020
- });
4021
- }(jQuery));;jQuery(document).ready(function($) {
4022
- window.sidekickWP = new SidekickWP.Models.App({
4023
- show_toggle_feedback: true
4024
- });
4025
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/sk_lab.js DELETED
@@ -1,5 +0,0 @@
1
- /*! LAB.js (LABjs :: Loading And Blocking JavaScript)
2
- v2.0.3 (c) Kyle Simpson
3
- MIT License
4
- */
5
- (function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
 
 
 
 
 
libs/admin_page.php ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php global $SK_PAID_LIBRARY_FILE, $SK_FREE_LIBRARY_FILE ?>
2
+
3
+ <style type="text/css">
4
+
5
+ .wrapper_main{
6
+ display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
7
+ display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
8
+ display: -ms-flexbox; /* TWEENER - IE 10 */
9
+ display: -webkit-flex; /* NEW - Chrome */
10
+ display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
11
+ -webkit-flex-wrap: wrap;
12
+ -moz-flex-wrap: wrap;
13
+ -ms-flex-wrap: wrap;
14
+ flex-wrap: wrap;
15
+ -webkit-flex-direction: row;
16
+ -moz-flex-direction: row;
17
+ -ms-flex-direction: row;
18
+ flex-direction: row;
19
+ }
20
+
21
+ .wrapper_main h3{
22
+ margin: 0;
23
+ }
24
+
25
+ .wrapper_main .box{
26
+ -webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
27
+ -moz-box-flex: 1; /* OLD - Firefox 19- */
28
+ -webkit-flex: 1; /* Chrome */
29
+ -ms-flex: 1; /* IE 10 */
30
+ flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
31
+ max-width: 50%;
32
+ }
33
+
34
+ .wrapper_left{
35
+ -webkit-flex-direction: column;
36
+ -moz-flex-direction: column;
37
+ -ms-flex-direction: column;
38
+ flex-direction: column;
39
+ }
40
+
41
+ .wrapper_left .box{
42
+ max-width: 100%;
43
+ }
44
+
45
+ .wrapper_right{
46
+ -webkit-flex-direction: column;
47
+ -moz-flex-direction: column;
48
+ -ms-flex-direction: column;
49
+ flex-direction: column;
50
+ }
51
+
52
+ .wrapper_right .box{
53
+ max-width: 100%;
54
+ }
55
+
56
+ .wrapper_wts{
57
+ display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
58
+ display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
59
+ display: -ms-flexbox; /* TWEENER - IE 10 */
60
+ display: -webkit-flex; /* NEW - Chrome */
61
+ display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
62
+ -webkit-flex-direction: row;
63
+ -moz-flex-direction: row;
64
+ -ms-flex-direction: row;
65
+ flex-direction: row;
66
+ -webkit-flex-wrap: wrap;
67
+ -moz-flex-wrap: wrap;
68
+ -ms-flex-wrap: wrap;
69
+ flex-wrap: wrap;
70
+ }
71
+
72
+ .wrapper_wts .box{
73
+ -webkit-flex-grow: 1;
74
+ -moz-flex-grow: 1;
75
+ -ms-flex-grow: 1;
76
+ flex-grow: 1;
77
+ min-width: 50%;
78
+ }
79
+
80
+ .wrapper_wts .box span{
81
+ padding: 3px;
82
+ display: block;
83
+ }
84
+
85
+ .well{
86
+ background-color: #fbfbfb;
87
+ margin-right: 10px;
88
+ margin-bottom: 10px;
89
+ padding: 20px;
90
+ border: 1px solid #e3e3e3;
91
+ border-radius: 4px;
92
+ min-height: 150px;
93
+ overflow: hidden;
94
+ }
95
+
96
+ .sidekick_admin a{
97
+ color: #F2641E;
98
+ }
99
+
100
+ .sidekick_admin ul{
101
+ margin-left: 20px;
102
+ }
103
+
104
+ .sidekick_admin ul li{
105
+ list-style-type: disc;
106
+ list-style-position: outside;
107
+ margin-left: 20px;
108
+ }
109
+
110
+ #sk_dashboard_message{
111
+ padding:15px;
112
+ position:relative;
113
+ }
114
+
115
+ a.sk_upgrade{
116
+ background-color: green;
117
+ color: white;
118
+ border-radius: 3px;
119
+ text-decoration: none;
120
+ padding: 3px;
121
+ margin-left: 10px;
122
+ }
123
+
124
+ .composer_beta_button{
125
+ background: #ff712b;
126
+ background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJod…EiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
127
+ background: -moz-linear-gradient(top, #ff712b 0%, #ed5f19 100%);
128
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff712b), color-stop(100%, #ed5f19));
129
+ background: -webkit-linear-gradient(top, #ff712b 0%, #ed5f19 100%);
130
+ background: -o-linear-gradient(top, #ff712b 0%, #ed5f19 100%);
131
+ background: -ms-linear-gradient(top, #ff712b 0%, #ed5f19 100%);
132
+ background: linear-gradient(to bottom, #ff712b 0%, #ed5f19 100%);
133
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff712b', endColorstr='#ed5f19', GradientType=0);
134
+ border-radius: 2px;
135
+ text-align: center;
136
+ float: right;
137
+ color: white;
138
+ padding: 10px;
139
+ font-size: 24px;
140
+ line-height: 29px;
141
+ border: solid 4px #9C3D0E;
142
+ margin-top: 20px;
143
+ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
144
+ }
145
+
146
+ .composer_beta_button:hover{
147
+ background: #e05c1b;
148
+ }
149
+
150
+ input.regular-text{
151
+ width: 100%;
152
+ }
153
+
154
+ </style>
155
+
156
+
157
+ <script type="text/javascript">
158
+
159
+ function sk_populate(data){
160
+ var passed_walkthroughs = window.sidekickWP.get('passed_walkthroughs');
161
+ var already_done = [];
162
+
163
+ _.each(passed_walkthroughs,function(item,key){
164
+ var checked = false;
165
+ var selected = false;
166
+
167
+ if (!already_done[item.id]) {
168
+ already_done[item.id] = true;
169
+ if (jQuery.inArray(item.id,sk_config.disable_wts) > -1) {
170
+ checked = 'CHECKED'
171
+ };
172
+ if (sk_config.autostart_walkthrough_id !== 'undefined' && sk_config.autostart_walkthrough_id == item.id) {
173
+ selected = 'SELECTED';
174
+ };
175
+ jQuery('.sk_walkthrough_list').append('<div class="box"><span><input type="checkbox" ' + checked + ' value="' + item.id + '" name="disable_wts[]">' + item.title + '<span></div>');
176
+ jQuery('[name="sk_autostart_walkthrough_id"]').append('<option ' + selected + ' value="' + item.id + '">' + item.title + '</option>');
177
+ };
178
+ })
179
+
180
+ }
181
+
182
+ jQuery(document).ready(function($) {
183
+ sk_populate();
184
+ if (sk_config.library_paid_file) {
185
+ jQuery.ajax({
186
+ url:'<?php echo $SK_PAID_LIBRARY_FILE ?>',
187
+ type:'HEAD',
188
+ error: function(data){
189
+ jQuery('.sk_license_status span').html('Invalid Key').css({color: 'red'});
190
+ jQuery('.sk_upgrade').show();
191
+ },
192
+ success: function(data){
193
+ if (_.size(sk_paid_library.buckets) > 0) {
194
+ jQuery('.sk_license_status').html('Valid').css({color: 'green'});
195
+ } else {
196
+ jQuery('.sk_license_status span').html('Expired').css({color: 'orange'});
197
+ jQuery('.sk_upgrade').show();
198
+ }
199
+ }
200
+ });
201
+ } else {
202
+ jQuery('.sk_upgrade').show();
203
+ }
204
+ });
205
+
206
+ </script>
207
+
208
+
209
+ <div class="page-header"><h2><a id="pluginlogo_32" class="header-icon32" href="http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=header" target="_blank"></a>Sidekick Dashboard</h2></div>
210
+
211
+ <h3>Welcome to the fastest and easiest way to learn WordPress</h3>
212
+
213
+ <?php if (isset($error_message)): ?>
214
+ <div class="error" id="sk_dashboard_message">
215
+ There was a problem activating your license. The following error occured <?php echo $error_message ?>
216
+ </div>
217
+ <?php elseif (isset($error)): ?>
218
+ <div class="error" id="sk_dashboard_message">
219
+ <?php echo $error ?>
220
+ </div>
221
+ <?php elseif (isset($warn)): ?>
222
+ <div class="updated" id="sk_dashboard_message">
223
+ <?php echo $warn ?>
224
+ </div>
225
+ <?php elseif (isset($success)): ?>
226
+ <div class="updated" id="sk_dashboard_message">
227
+ <?php echo $success ?>
228
+ </div>
229
+ <?php endif ?>
230
+
231
+ <div class="sidekick_admin wrapper_main">
232
+
233
+ <div class="box left">
234
+ <div class="wrapper_left">
235
+ <div class="box license">
236
+ <div class="well">
237
+ <?php if (!$error): ?>
238
+ <h3>My Sidekick Account</h3>
239
+ <form method="post">
240
+ <?php settings_fields('sk_license'); ?>
241
+ <table class="form-table">
242
+ <tbody>
243
+ <tr valign="top">
244
+ <th scope="row" valign="top">Activation ID</th>
245
+ <td><input class='regular-text' type='text' name='activation_id' value='<?php echo $activation_id ?>'></input></td>
246
+ </tr>
247
+
248
+ <tr valign="top">
249
+ <th scope="row" valign="top">Status</th>
250
+ <td><span style='color: blue' class='sk_license_status'><span><?php echo ucfirst($status) ?></span> <a style='display: none' class='sk_upgrade' href='http://www.sidekick.pro/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade' target="_blank"> Upgrade Now!</a> </span></td>
251
+ </tr>
252
+
253
+ <tr valign="top">
254
+ <th scope="row" valign="top">
255
+ Data Tracking
256
+ </th>
257
+ <td>
258
+ <input name="sk_track_data" type="checkbox" <?php if ($sk_track_data): ?>CHECKED<?php endif ?> />
259
+ <input type='hidden' name='status' value='<?php echo $status ?>'/>
260
+ <label class="description" for="track_data">Help Sidekick by providing tracking data which will help us build better help tools.</label>
261
+ </td>
262
+ </tr>
263
+
264
+ <tr valign="top" style='display: none'>
265
+ <th scope="row" valign="top">
266
+ Enable Composer Mode
267
+ </th>
268
+ <td>
269
+ <input name="sk_composer_button" type="checkbox" <?php if (get_option('sk_composer_button')): ?>CHECKED<?php endif ?> />
270
+ <label class="description" for="track_data">Enable Walkthrough creation.</label>
271
+ </td>
272
+ </tr>
273
+ </tbody>
274
+ </table>
275
+ <?php submit_button('Update'); ?>
276
+ </form>
277
+ <?php endif ?>
278
+ </div>
279
+ </div>
280
+
281
+ <div class="box composer">
282
+ <div class="well">
283
+ <h3>Build Your Own Walkthroughs - Get Composer</h3>
284
+ <a href='http://www.sidekick.pro/plans/?utm_source=plugin&utm_medium=settings&utm_campaign=composerbeta' target='_blank'><div class='composer_beta_button'>Join the<br/>Composer Beta</div></a>
285
+ <ul>
286
+ <li>Join the <a href='http://www.sidekick.pro/plans/' target='_blank'>Composer Beta</a> now!</li>
287
+ <li><a href="http://www.sidekick.pro/plans/" target="_blank">Check out our Composer Plans</a></li>
288
+ </ul>
289
+ </div>
290
+ </div>
291
+
292
+ <div class="box you_should_know">
293
+ <div class="well">
294
+ <h3>Few Things you should know:</h3>
295
+ <div class="">
296
+ <ul>
297
+ <li>Clicking the check-box above will allow us to link your email address to the stats we collect so we can contact you if we have a question or notice an issue. It’s not mandatory, but it would help us out.</li>
298
+ <li>Your Activation ID is unique and limited to your production, staging, and development urls.</li>
299
+ <li>The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site.</li>
300
+ <li>If you have any questions, bug reports or feedback, please send them to <a target="_blank" href="mailto:info@sidekick.pro">us</a> </li>
301
+ <li>You can find our terms of use <a target="_blank" href="http://www.sidekick.pro/terms-of-use/">here</a></li>
302
+ </ul>
303
+ </div>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ </div>
308
+
309
+ <div class="box right">
310
+ <div class="wrapper_right">
311
+ <div class="box">
312
+ <div class="well">
313
+ <h3>Configure</h3>
314
+
315
+ <form method='post'>
316
+
317
+ <h4>Auto Start Walkthrough</h4>
318
+
319
+ <p>This Walkthrough will be played once for every user that logs into the backend of WordPress.</p>
320
+ <select name='sk_autostart_walkthrough_id'>
321
+ <option value='0'>No Auto Start</option>
322
+ </select>
323
+ <input class='button button-primary' type='submit' value='Save'/>
324
+
325
+ <h4>Turn Off Walkthroughs</h4>
326
+
327
+ <p>Below you can turn off specific Walkthroughs for this website.</p>
328
+ <div class='sk_walkthrough_list wrapper_wts'></div>
329
+ <input class='button button-primary' type='submit' value='Save'/>
330
+ </form>
331
+ </div>
332
+ </div>
333
+
334
+ <div class="box love">
335
+ <div class="well">
336
+ <h3>Love the Sidekick plugin?</h3>
337
+ <ul>
338
+ <li>Please help spread the word!</li>
339
+ <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://sidekick.pro" data-text="I use @sidekickhelps for the fastest and easiest way to learn WordPress." data-via="sidekickhelps" data-size="large">Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
340
+ <li>Like SIDEKICK? Please leave us a 5 star rating on <a href='http://WordPress.org' target='_blank'>WordPress.org</a></li>
341
+ <li><a href="http://www.sidekick.pro/wordpress/modules/wordpress-core-module-premium/">Check out the full WordPress Core Premium (150+ Walkthroughs)</a></li>
342
+ <li><a href="http://wordpress.org/support/plugin/sidekick" target="_blank"><strong>Visit the plugin Help &amp; Support page</strong></a>.</li>
343
+ </ul>
344
+ </div>
345
+ </div>
346
+ </div>
347
+ </div>
348
+
349
+
350
+
libs/sk_config_data.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class sk_config_data{
4
+ function get_domain(){
5
+ $site_url = get_site_url();
6
+ if(substr($site_url, -1) == '/') {
7
+ $site_url = substr($site_url, 0, -1);
8
+ }
9
+ $site_url = str_replace(array("http://","https://"),array(""),$site_url);
10
+ return $site_url;
11
+ }
12
+
13
+ function get_post_types(){
14
+ global $wpdb;
15
+ $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
16
+ $counts = $wpdb->get_results($query);
17
+
18
+ foreach ($counts as $key => $type) {
19
+ $type->post_type = str_replace('-', '_', $type->post_type);
20
+ $output .= "\n post_type_{$type->post_type} : $type->count,";
21
+ }
22
+ return $output;
23
+ }
24
+
25
+ function get_themes(){
26
+ $themes = wp_get_themes( array( 'allowed' => true ) );
27
+ return count($themes);
28
+ }
29
+
30
+ function get_post_types_and_statuses(){
31
+ global $wpdb;
32
+ $query = "SELECT post_type, post_status, count(distinct ID) as count from wp_posts group by post_type, post_status";
33
+ $counts = $wpdb->get_results($query);
34
+
35
+ foreach ($counts as $key => $type) {
36
+ $type->post_type = str_replace('-', '_', $type->post_type);
37
+ $type->post_status = str_replace('-', '_', $type->post_status);
38
+
39
+ $output .= "\n post_type_{$type->post_type}_{$type->post_status} : $type->count,";
40
+ }
41
+ return $output;
42
+ }
43
+
44
+ function get_taxonomies(){
45
+ global $wpdb;
46
+ $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
47
+ $counts = $wpdb->get_results($query);
48
+
49
+ foreach ($counts as $key => $taxonomy) {
50
+ $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
51
+ $output .= "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
52
+ }
53
+ return $output;
54
+ }
55
+
56
+ function get_comments(){
57
+ global $wpdb;
58
+ $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
59
+ $counts = $wpdb->get_var($query);
60
+ if (!$counts) $counts = 0;
61
+ return "\n comment_count : $counts,";
62
+ }
63
+
64
+ function get_post_statuses(){
65
+ global $wpdb;
66
+ $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
67
+ $counts = $wpdb->get_results($query);
68
+
69
+ foreach ($counts as $key => $type) {
70
+ $type->post_status = str_replace('-', '_', $type->post_status);
71
+ $output .= "\n post_status_{$type->post_status} : $type->count,";
72
+ }
73
+ return $output;
74
+ }
75
+
76
+ function get_user_data(){
77
+ global $current_user;
78
+ $data = get_userdata($current_user->ID);
79
+ $output .= "\n user_id : $current_user->ID,";
80
+ foreach ($data->allcaps as $cap => $val) {
81
+ $cap = sanitize_title($cap);
82
+ $cap = str_replace('-', '_', $cap);
83
+ $output .= "\n cap_{$cap} : $val,";
84
+ }
85
+ return $output;
86
+ }
87
+
88
+ function get_current_url() {
89
+ if (isset($_SERVER['REQUEST_URI'])) {
90
+ return 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
91
+ } else if (isset($_SERVER['PATH_INFO'])) {
92
+ return $_SERVER['PATH_INFO'];
93
+ } else {
94
+ $host = $_SERVER['HTTP_HOST'];
95
+ $port = $_SERVER['SERVER_PORT'];
96
+ $request = $_SERVER['PHP_SELF'];
97
+ $query = isset($_SERVER['argv']) ? substr($_SERVER['argv'][0], strpos($_SERVER['argv'][0], ';') + 1) : '';
98
+ $toret = $protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request . (empty($query) ? '' : '?' . $query);
99
+ return $toret;
100
+ }
101
+ }
102
+
103
+ function get_disabled_wts(){
104
+ $wts = str_replace('"', '', get_option('sk_disabled_wts'));
105
+ if ($wts) {
106
+ return $wts;
107
+ }
108
+ return 'false';
109
+ }
110
+
111
+ function get_plugins(){
112
+ $active_plugins = wp_get_active_and_valid_plugins();
113
+ $mu_plugins = get_mu_plugins();
114
+
115
+ $printed = false;
116
+
117
+ $output .= '[';
118
+
119
+ if (is_array($active_plugins)) {
120
+ foreach ($active_plugins as $plugins_key => $plugin) {
121
+ $data = get_plugin_data( $plugin, false, false );
122
+
123
+ $plugins[addslashes($data['Name'])] = $data['Version'];
124
+ if ($plugins_key > 0) $output .= ',';
125
+ $data['Name'] = addslashes($data['Name']);
126
+ $output .= "{'{$data['Name']}' : '{$data['Version']}'}";
127
+ $printed = true;
128
+ }
129
+ }
130
+
131
+ if (is_array($mu_plugins)) {
132
+ foreach ($mu_plugins as $plugins_key => $plugin) {
133
+ $plugins[addslashes($data['Name'])] = $plugin['Version'];
134
+ if ($printed) $output .= ',';
135
+ $plugin['Name'] = addslashes($plugin['Name']);
136
+ $output .= "{'{$plugin['Name']}' : '{$plugin['Version']}'}";
137
+ $printed = true;
138
+ }
139
+ }
140
+ $output .= ']';
141
+ return $output;
142
+ }
143
+
144
+ function get_user_role(){
145
+ global $current_user, $wp_roles;
146
+ if(!isset($current_user->caps) || count($current_user->caps) < 1){
147
+ // In MS in some specific pages current user is returning empty caps so this is a work around for that case.
148
+ if (current_user_can('activate_plugins')){
149
+ return 'administrator';
150
+ }
151
+ }
152
+ foreach($wp_roles->role_names as $role => $Role) {
153
+ if (array_key_exists($role, $current_user->caps)){
154
+ $user_role = $role;
155
+ break;
156
+ }
157
+ }
158
+ return $user_role;
159
+ }
160
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.sidekick.pro
4
  Tags: help, tutorial, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 3.9
7
- Stable tag: 1.4
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -130,7 +130,27 @@ Absolutely. In fact, we rely on users like you to tell us about things that nee
130
 
131
  == Changelog ==
132
 
133
- = 1.4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  * Switch over to new platform version
135
  * Sidekick Activation Bug Fixed
136
  * CSS Fixes
4
  Tags: help, tutorial, training, learn, learning, sidekick, guide, teach, video, manual, videos, wphelp, support, instructions, question, questions, answers, answer, clippy, q&a, wpuniversity, helper, walkthrough
5
  Requires at least: 3.7
6
  Tested up to: 3.9
7
+ Stable tag: 1.5.2
8
  License: GNU Version 2 or Any Later Version
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.5.2 =
134
+ * Fixed Multisite issue with role detection on certain pages
135
+
136
+ = 1.5.1 =
137
+ * Added more parameters to tag Walkthroughs againts
138
+
139
+ = 1.5.0 =
140
+ * Paid vs Free Walkthrough Seperation
141
+ * Clean Up of Logs
142
+
143
+ = 1.4.2 =
144
+ * New Administration Screen
145
+ * Auto Start of a Walkthrough for each user
146
+ * Disable Specific Walkthroughs
147
+
148
+ = 1.4.1 =
149
+ * Fixed issue with hotspot button not showing
150
+ * Added ability to auto start a Walkthrough
151
+ * Added ability to disable specific Walkthroughs
152
+
153
+ = 1.4 =
154
  * Switch over to new platform version
155
  * Sidekick Activation Bug Fixed
156
  * CSS Fixes
sidekick.php CHANGED
@@ -6,15 +6,14 @@ Plugin URL: http://wordpress.org/plugins/sidekick/
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 3.7
8
  Tested up to: 3.9.1
9
- Version: 1.4
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
- define('SK_PLUGIN_VERSION','1.4');
15
- define('SK_LIBRARY_VERSION',5);
16
- define('SK_PLATFORM_VERSION',9);
17
  define('DEFAULT_ACTIVATION_ID','xxxxxxxx-xxxx-xxxx-xxxx-xxxxfree');
 
18
 
19
  if ( ! defined( 'SK_SL_PLUGIN_DIR' ) ) define( 'SK_SL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
20
  if ( ! defined( 'SK_SL_PLUGIN_URL' ) ) define( 'SK_SL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -24,6 +23,26 @@ if ( ! function_exists('mlog')) {
24
  }
25
 
26
  class Sidekick{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  function enqueue_required(){
28
  wp_enqueue_script('jquery' , null );
29
  wp_enqueue_script('underscore' , null, array('underscore'));
@@ -45,23 +64,23 @@ class Sidekick{
45
  }
46
 
47
  function enqueue(){
 
 
48
  $activation_id = get_option("sk_activation_id");
49
 
50
  $protocol = $this->protocol();
51
 
52
- define('SK_FREE_LIBRARY_FILE', "{$protocol}library.sidekick.pro/library/v" . SK_LIBRARY_VERSION . "/releases/xxxxxxxx-xxxx-xxxx-xxxx-xxxxfree/library.js?" . date('m-d-y-G'));
53
  if ($activation_id) {
54
- define('SK_PAID_LIBRARY_FILE', "{$protocol}library.sidekick.pro/library/v" . SK_LIBRARY_VERSION . "/releases/{$activation_id}/library.js?" . date('m-d-y-G'));
55
- wp_enqueue_script("sk_paid_library" , SK_PAID_LIBRARY_FILE , null ,null);
56
- wp_enqueue_script("sk_free_library" , SK_FREE_LIBRARY_FILE , array('sk_paid_library') ,null);
57
  } else {
58
- wp_enqueue_script("sk_free_library" , SK_FREE_LIBRARY_FILE , array() ,null);
59
  }
60
 
61
- wp_enqueue_script('sidekick' ,"{$protocol}platform.sidekick.pro/v" . SK_PLATFORM_VERSION . '/wordpress/sidekick.min.js', array('sk_free_library','backbone','jquery','underscore','jquery-effects-highlight'), SK_PLUGIN_VERSION);
62
- wp_enqueue_script('player' ,plugins_url( '/js/sk.source.js' , __FILE__ ), array('sidekick') ,SK_PLUGIN_VERSION);
63
 
64
- wp_enqueue_style('sk-style' ,plugins_url( '/css/sidekick_wordpress.css' , __FILE__ ), null ,SK_PLUGIN_VERSION);
65
 
66
  wp_enqueue_style('wp-pointer');
67
  wp_enqueue_script('wp-pointer');
@@ -71,7 +90,17 @@ class Sidekick{
71
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
72
  }
73
 
 
 
 
 
 
 
 
 
74
  function admin_page(){
 
 
75
  if (isset($_POST['option_page']) && $_POST['option_page'] == 'sk_license') {
76
 
77
  if (isset($_POST['first_name']) && $_POST['first_name'])
@@ -102,43 +131,26 @@ class Sidekick{
102
  die('<script>window.open("' . get_site_url() . '/wp-admin/options-general.php?page=sidekick","_self")</script>');
103
  }
104
 
105
- $activation_id = get_option( 'sk_activation_id' );
106
- $email = get_option( 'sk_email' );
107
- $first_name = get_option( 'sk_first_name' );
108
- $sk_track_data = get_option( 'sk_track_data' );
109
- $sk_composer_button = get_option ('sk_composer_button');
110
- $error = null;
 
 
 
 
 
111
 
112
- if (defined('SK_PAID_LIBRARY_FILE') && $activation_id) {
113
  $_POST['activation_id'] = $activation_id;
114
  $check_activation = $this->activate(true);
115
- if ($check_activation) {
116
- $library = file_get_contents(SK_PAID_LIBRARY_FILE);
117
- if (strlen($library) > 30) {
118
- $site_url = $this->get_domain();
119
- if (strpos($library, $site_url) !== false) {
120
- $status = 'Active';
121
- } else {
122
- $status = 'Domain not authorized.';
123
- }
124
- } else {
125
- $status = 'Expired';
126
- }
127
- } else {
128
- $status = 'Invalid';
129
- }
130
- } else {
131
- $status = 'Free';
132
  }
133
 
134
- $current_user = wp_get_current_user();
135
- if (!$first_name)
136
- $first_name = $current_user->user_firstname;
137
-
138
- if (!$email)
139
- $email = $current_user->user_email;
140
-
141
- $sk_track_data = get_option( 'sk_track_data' );
142
 
143
  global $wp_version;
144
  if (version_compare($wp_version, '3.7', '<=')) {
@@ -146,7 +158,7 @@ class Sidekick{
146
  }
147
 
148
  if (!$activation_id) {
149
- $warn = "You're using the <b>free</b> version of Sidekick, to gain full access to the walkthrough library please <a target='_blank' href='http://www.sidekick.pro/wordpress/modules/'>upgrade</a> to the full module.";
150
  }
151
 
152
  if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
@@ -165,186 +177,50 @@ class Sidekick{
165
  <?php endif ?>
166
 
167
  <div class="wrap">
168
- <div class="icon32" id="icon-tools"><br></div><h2>Sidekick</h2>
169
-
170
- <?php if (isset($error_message)): ?>
171
- <div class="error" style="padding:15px; position:relative;" id="gf_dashboard_message">
172
- There was a problem activating your license. The following error occured <?php echo $error_message ?>
173
- </div>
174
- <?php elseif (isset($error)): ?>
175
- <div class="error" style="padding:15px; position:relative;" id="gf_dashboard_message">
176
- <?php echo $error ?>
177
- </div>
178
- <?php elseif (isset($warn)): ?>
179
- <div class="updated" style="padding:15px; position:relative;" id="gf_dashboard_message">
180
- <?php echo $warn ?>
181
- </div>
182
- <?php elseif (isset($success)): ?>
183
- <div class="updated" style="padding:15px; position:relative;" id="gf_dashboard_message">
184
- <?php echo $success ?>
185
- </div>
186
- <?php endif ?>
187
-
188
- <?php if (!$error): ?>
189
- <h3>Your Sidekick Account</h3>
190
- <form method="post">
191
- <?php settings_fields('sk_license'); ?>
192
- <table class="form-table">
193
- <tbody>
194
- <tr valign="top">
195
- <th scope="row" valign="top">Activation ID</th>
196
- <td><input class='regular-text' type='text' name='activation_id' value='<?php echo $activation_id ?>'></input></td>
197
- </tr>
198
-
199
- <tr valign="top">
200
- <th scope="row" valign="top">Status</th>
201
- <td><span style='color: green' class='<?php echo strtolower($status) ?>'><?php echo ucfirst($status) ?></span></td>
202
- </tr>
203
-
204
- <tr valign="top">
205
- <th scope="row" valign="top">
206
- Data Tracking
207
- </th>
208
- <td>
209
- <input name="sk_track_data" type="checkbox" <?php if ($sk_track_data): ?>CHECKED<?php endif ?> />
210
- <input type='hidden' name='status' value='<?php echo $status ?>'/>
211
- <label class="description" for="track_data">Help Sidekick by providing tracking data which will help us build better help tools.</label>
212
- </td>
213
- </tr>
214
-
215
- <tr valign="top" style='display: none'>
216
- <th scope="row" valign="top">
217
- Enable Composer Mode
218
- </th>
219
- <td>
220
- <input name="sk_composer_button" type="checkbox" <?php if ($sk_composer_button): ?>CHECKED<?php endif ?> />
221
- <label class="description" for="track_data">Enable Walkthrough creation.</label>
222
- </td>
223
- </tr>
224
- </tbody>
225
- </table>
226
- <?php submit_button('Update'); ?>
227
- </form>
228
- <?php endif ?>
229
-
230
- <h3>Welcome to the fastest and easiest way to learn WordPress</h3>
231
-
232
- <p></p>
233
- <p>Like SIDEKICK? Please leave us a 5 star rating on <a target='_blank' href='http://wordpress.org/plugins/sidekick/'>http://WordPress.org</a></p>
234
- <br/>
235
- <p>Here are a few things you should know:</p>
236
-
237
- <ul>
238
- <li>&nbsp;&nbsp;&nbsp;&nbsp;1. Clicking the check-box above will allow us to link your email address to the stats we collect so we can contact you if we have a question or notice an issue. It’s not mandatory, but it would help us out. </li>
239
- <li>&nbsp;&nbsp;&nbsp;&nbsp;2. Your Activation ID is unique and locked to this URL. </li>
240
- <li>&nbsp;&nbsp;&nbsp;&nbsp;3. Want even more Walkthroughs for WordPress, WooCommerce and more? <a target='_blank' href='http://www.sidekick.pro/wordpress/modules?utm_source=plugin_settings'>UPGRADE Now!</a> </li>
241
- <li>&nbsp;&nbsp;&nbsp;&nbsp;4. The Sidekick team adheres strictly to CANSPAM. From time to time we may send critical updates (such as security notices) to the email address setup as the Administrator on this site. </li>
242
- <li>&nbsp;&nbsp;&nbsp;&nbsp;5. If you have any questions, bug reports or feedback, please send them to <a target='_blank' href='mailto:info@sidekick.pro'>us</a> </li>
243
- <li>&nbsp;&nbsp;&nbsp;&nbsp;6. You can find our terms of use <a target='_blank' href='http://www.sidekick.pro/terms-of-use/'>here</a></li>
244
- </ul>
245
- <p>Thank you,</p>
246
- <br/>
247
-
248
  </div>
249
  <?php
250
  }
251
 
252
- function get_domain(){
253
- $site_url = get_site_url();
254
- if(substr($site_url, -1) == '/') {
255
- $site_url = substr($site_url, 0, -1);
256
- }
257
- $site_url = str_replace(array("http://","https://"),array(""),$site_url);
258
- return $site_url;
259
- }
260
-
261
- function list_post_types(){
262
- global $wpdb;
263
- $query = "SELECT post_type, count(distinct ID) as count from {$wpdb->prefix}posts group by post_type";
264
- $counts = $wpdb->get_results($query);
265
- foreach ($counts as $key => $type) {
266
- $type->post_type = str_replace('-', '_', $type->post_type);
267
- echo "\n post_type_{$type->post_type} : $type->count,";
268
- }
269
- }
270
-
271
- function list_taxonomies(){
272
- global $wpdb;
273
- $query = "SELECT count(distinct term_taxonomy_id) as count, taxonomy from {$wpdb->prefix}term_taxonomy group by taxonomy";
274
- $counts = $wpdb->get_results($query);
275
- foreach ($counts as $key => $taxonomy) {
276
- $taxonomy->taxonomy = str_replace('-', '_', $taxonomy->taxonomy);
277
- echo "\n taxonomy_{$taxonomy->taxonomy} : $taxonomy->count,";
278
- }
279
- }
280
-
281
- function list_comments(){
282
- global $wpdb;
283
- $query = "SELECT count(distinct comment_ID) as count from {$wpdb->prefix}comments";
284
- $counts = $wpdb->get_var($query);
285
- if (!$counts) $counts = 0;
286
- echo "\n comment_count : $counts,";
287
- }
288
-
289
- function list_post_statuses(){
290
- global $wpdb;
291
- $query = "SELECT post_status, count(ID) as count from {$wpdb->prefix}posts group by post_status";
292
- $counts = $wpdb->get_results($query);
293
- foreach ($counts as $key => $type) {
294
- $type->post_status = str_replace('-', '_', $type->post_status);
295
- echo "\n post_status_{$type->post_status} : $type->count,";
296
- }
297
- }
298
-
299
- function get_user_data(){
300
- global $current_user;
301
- $data = get_userdata($current_user->ID);
302
- echo "\n user_id : $current_user->ID,";
303
- foreach ($data->allcaps as $cap => $val) {
304
- $cap = sanitize_title($cap);
305
- $cap = str_replace('-', '_', $cap);
306
- echo "\n cap_{$cap} : $val,";
307
- }
308
- }
309
-
310
- function get_current_url() {
311
-
312
- if (isset($_SERVER['REQUEST_URI'])) {
313
- return 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
314
- } else if (isset($_SERVER['PATH_INFO'])) {
315
- return $_SERVER['PATH_INFO'];
316
- } else {
317
- $host = $_SERVER['HTTP_HOST'];
318
- $port = $_SERVER['SERVER_PORT'];
319
- $request = $_SERVER['PHP_SELF'];
320
- $query = isset($_SERVER['argv']) ? substr($_SERVER['argv'][0], strpos($_SERVER['argv'][0], ';') + 1) : '';
321
- $toret = $protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request . (empty($query) ? '' : '?' . $query);
322
- return $toret;
323
- }
324
  }
325
 
326
  function footer(){
327
- global $current_user, $wp_roles;
328
-
329
- $current_user = wp_get_current_user();
330
- $sk_just_activated = get_option( 'sk_just_activated' );
331
- $sk_track_data = get_option( 'sk_track_data' );
332
- $theme = wp_get_theme();
333
- $not_supported_ie = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  delete_option( 'sk_just_activated' );
336
- foreach($wp_roles->role_names as $role => $Role) {
337
- if (array_key_exists($role, $current_user->caps)){
338
- $user_role = $role;
339
- break;
340
- }
341
- }
342
-
343
- if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
344
- $not_supported_ie = true;
345
- }
346
 
347
- $site_url = $this->get_domain();
348
 
349
  ?>
350
 
@@ -353,188 +229,184 @@ class Sidekick{
353
  <script type="text/javascript">
354
 
355
  var sk_config = {
356
- domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
357
- base_url: '<?php echo site_url() ?>',
358
- installed_plugins: <?php echo $this->list_plugins() ?>,
359
- installed_theme: '<?php echo $theme->Name ?>',
360
- library_free_file: '<?php echo (defined("SK_FREE_LIBRARY_FILE") ? SK_FREE_LIBRARY_FILE : '') ?>',
361
- library_paid_file: '<?php echo (defined("SK_PAID_LIBRARY_FILE") ? SK_PAID_LIBRARY_FILE : '') ?>',
362
- library_version: '<?php echo (defined("SK_LIBRARY_VERSION") ? SK_LIBRARY_VERSION : '') ?>',
363
- plugin_version: '<?php echo (defined("SK_PLUGIN_VERSION") ? SK_PLUGIN_VERSION : '') ?>',
364
- platform_version: '<?php echo (defined("SK_PLATFORM_VERSION") ? SK_PLATFORM_VERSION : '') ?>',
365
- main_soft_name: 'WordPress',
366
- main_soft_version: '<?php echo get_bloginfo("version") ?>',
367
- plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
368
- current_url: '<?php echo $this->get_current_url() ?>',
369
- theme_version: '<?php echo $theme->Version ?>',
370
- site_url: '<?php echo $site_url ?>',
371
- track_data: '<?php echo get_option( "track_data" ) ?>',
372
- user_level: '<?php echo $user_role ?>',
373
- user_email: '<?php echo $current_user->user_email ?>',
374
- is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
375
- <?php $this->list_post_types() ?>
376
- <?php $this->list_taxonomies() ?>
377
- <?php $this->get_user_data() ?>
378
- <?php $this->list_comments() ?>
379
- <?php $this->list_post_statuses() ?>
380
- use_native_controls: false
381
- // open_bucket: 476
382
- }
383
- <?php if ($activation_id = get_option( "sk_activation_id" )){ ?>
384
- sk_config.activation_id = '<?php echo $activation_id ?>';
385
- <?php } else { ?>
386
- sk_config.activation_id = '<?php echo DEFAULT_ACTIVATION_ID ?>';
387
- <?php } ?>
388
- <?php if (get_option( "sk_composer_button" )){ ?>sk_config.sk_composer_button = '<?php echo true ?>';<?php } ?>
389
- <?php if ($sk_just_activated): ?>sk_config.just_activated = true;sk_config.show_login = true;<?php endif; ?>
390
-
391
- var skc_config = {
392
- API_URL: 'http://library.sidekick.pro/api'
393
- }
394
-
395
- </script>
396
- <?php endif ?>
397
- <?php
398
- }
399
 
400
- function list_plugins(){
401
- $active_plugins = wp_get_active_and_valid_plugins();
402
- $mu_plugins = get_mu_plugins();
 
 
403
 
404
- $printed = false;
405
 
406
- echo '[';
 
 
 
407
 
408
- if (is_array($active_plugins)) {
409
- foreach ($active_plugins as $plugins_key => $plugin) {
410
- $data = get_plugin_data( $plugin, false, false );
411
 
412
- $plugins[addslashes($data['Name'])] = $data['Version'];
413
- if ($plugins_key > 0) echo ',';
414
- $data['Name'] = addslashes($data['Name']);
415
- echo "{'{$data['Name']}' : '{$data['Version']}'}";
416
- $printed = true;
417
- }
418
- }
 
 
 
 
 
419
 
420
- if (is_array($mu_plugins)) {
421
- foreach ($mu_plugins as $plugins_key => $plugin) {
422
- $plugins[addslashes($data['Name'])] = $plugin['Version'];
423
- if ($printed) echo ',';
424
- $plugin['Name'] = addslashes($plugin['Name']);
425
- echo "{'{$plugin['Name']}' : '{$plugin['Version']}'}";
426
- $printed = true;
427
- }
428
- }
429
- echo ']';
430
- }
431
 
432
- function track($data){
433
  $protocol = $this->protocol();
434
 
435
- $response = wp_remote_post( "{$protocol}library.sidekick.pro/wp-admin/admin-ajax.php", array(
436
- 'method' => 'POST',
437
- 'timeout' => 45,
438
- 'redirection' => 5,
439
- 'httpversion' => '1.0',
440
- 'blocking' => true,
441
- 'headers' => array(),
442
- 'body' => $data,
443
- 'cookies' => array()
444
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  );
 
 
 
 
 
 
 
 
 
446
  }
447
 
448
- function activate($return = false){
449
- if ($_POST['activation_id']) {
450
-
451
- $protocol = $this->protocol();
452
-
453
- $library_file = "{$protocol}library.sidekick.pro/library/v" . SK_LIBRARY_VERSION . "/releases/{$_POST['activation_id']}/library.js";
454
- $ch = curl_init($library_file);
455
- curl_setopt($ch, CURLOPT_NOBODY, true);
456
- curl_exec($ch);
457
- $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
458
- curl_close($ch);
459
- if ($retcode == 200) {
460
- update_option('sk_activation_id',$_POST['activation_id']);
461
- if ($return)
462
- return 1;
463
- die(json_encode(array('success' => 1)));
464
- } else {
465
- delete_option( 'sk_activation_id' );
466
- if ($return)
467
- return $retcode;
468
- die(json_encode(array('error' => $retcode)));
469
- }
470
- } else {
471
- die(json_encode(array('error' => 'No Activation ID')));
472
- }
473
  }
 
474
 
475
- function activate_plugin(){
476
- update_option( 'sk_firstuse', true );
477
- update_option( 'sk_do_activation_redirect', true );
478
  $data = array(
479
  'source' => 'plugin',
480
  'action' => 'track',
481
- 'type' => 'activate'
 
482
  );
483
  $this->track($data);
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  }
485
-
486
- function redirect(){
487
- if (get_option('sk_do_activation_redirect', false)) {
488
- delete_option('sk_do_activation_redirect');
489
- $siteurl = get_site_url();
490
- wp_redirect($siteurl . "/wp-admin/options-general.php?page=sidekick");
491
- die();
492
- }
493
- }
494
-
495
- function deactivate_plugin(){
496
- $sk_track_data = get_option( 'sk_track_data' );
497
- if ($sk_track_data) {
498
- $data = array(
499
- 'source' => 'plugin',
500
- 'action' => 'track',
501
- 'type' => 'deactivate',
502
- 'user' => get_option( "activation_id" )
503
- );
504
- $this->track($data);
505
- ?>
506
- <script type="text/javascript">
507
- window._gaq = window._gaq || [];
508
- window._gaq.push(['sk._setAccount', 'UA-39283622-1']);
509
-
510
- (function() {
511
- var ga_wpu = document.createElement('script'); ga_sk.type = 'text/javascript'; ga_sk.async = true;
512
- ga_sk.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
513
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga_wpu, s);
514
- })();
515
- window._gaq.push(['sk._trackEvent', 'Plugin - Deactivate', '', <?php echo plugin_version ?>, 0,true]);
516
- </script>
517
- <?php
518
- }
519
- delete_option( 'sk_activation_id' );
520
- delete_option( 'sk_first_name' );
521
- delete_option( 'sk_email' );
522
- delete_option( 'sk_activated' );
523
- }
524
  }
 
 
 
 
 
525
 
526
- $sidekick = new Sidekick;
527
- register_activation_hook( __FILE__, array($sidekick,'activate_plugin') );
528
- register_deactivation_hook( __FILE__, array($sidekick,'deactivate_plugin') );
 
529
 
530
- add_action('admin_menu', array($sidekick,'setup_menu'));
531
- add_action('admin_init', array($sidekick,'redirect'));
532
- add_action('wp_ajax_sk_activate', array($sidekick,'activate'));
533
 
534
- if (!defined('SK_PLUGIN_DEGBUG'))
535
- require_once('sk_init.php');
536
 
537
- if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information') && !defined('IFRAME_REQUEST')) {
538
- add_action('admin_footer', array($sidekick,'footer'));
539
- add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
540
- }
6
  Description: Adds a real-time WordPress training walkthroughs right in your Dashboard
7
  Requires at least: 3.7
8
  Tested up to: 3.9.1
9
+ Version: 1.5.2
10
  Author: Sidekick.pro
11
  Author URI: http://www.sidekick.pro
12
  */
13
 
14
+ define('SK_LIBRARY_VERSION',6);
 
 
15
  define('DEFAULT_ACTIVATION_ID','xxxxxxxx-xxxx-xxxx-xxxx-xxxxfree');
16
+ define('SK_LIBRARY_DOMAIN','pullvod.flowpress.netdna-cdn.com/library');
17
 
18
  if ( ! defined( 'SK_SL_PLUGIN_DIR' ) ) define( 'SK_SL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
19
  if ( ! defined( 'SK_SL_PLUGIN_URL' ) ) define( 'SK_SL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
23
  }
24
 
25
  class Sidekick{
26
+
27
+ function __construct(){
28
+ global $SK_FREE_LIBRARY_FILE, $SK_PAID_LIBRARY_FILE;
29
+ $activation_id = get_option("sk_activation_id");
30
+
31
+ $protocol = $this->protocol();
32
+ $this->check_versions();
33
+
34
+ if (strpos($_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'], '.sidekick')) {
35
+ $version = time();
36
+ } else {
37
+ $version = date('m-d-y-G');
38
+ }
39
+
40
+ $SK_FREE_LIBRARY_FILE = $protocol . SK_LIBRARY_DOMAIN . "/v" . SK_LIBRARY_VERSION . "/releases/xxxxxxxx-xxxx-xxxx-xxxx-xxxxfree/library.js?{$version}";
41
+ if ($activation_id) {
42
+ $SK_PAID_LIBRARY_FILE = $protocol . SK_LIBRARY_DOMAIN . "/v" . SK_LIBRARY_VERSION . "/releases/{$activation_id}/library.js?{$version}";
43
+ }
44
+ }
45
+
46
  function enqueue_required(){
47
  wp_enqueue_script('jquery' , null );
48
  wp_enqueue_script('underscore' , null, array('underscore'));
64
  }
65
 
66
  function enqueue(){
67
+ global $SK_FREE_LIBRARY_FILE, $SK_PAID_LIBRARY_FILE;
68
+
69
  $activation_id = get_option("sk_activation_id");
70
 
71
  $protocol = $this->protocol();
72
 
 
73
  if ($activation_id) {
74
+ wp_enqueue_script("sk_paid_library" , $SK_PAID_LIBRARY_FILE,null,null);
75
+ wp_enqueue_script("sk_free_library" , $SK_FREE_LIBRARY_FILE,array('sk_paid_library'),null);
 
76
  } else {
77
+ wp_enqueue_script("sk_free_library" , $SK_FREE_LIBRARY_FILE,array(),null);
78
  }
79
 
80
+ wp_enqueue_script('sidekick' ,"{$protocol}platform.sidekick.pro/wordpress/sidekick.min.js", array('sk_free_library','backbone','jquery','underscore','jquery-effects-highlight'), get_transient( 'sk_platform_version' ));
81
+ wp_enqueue_script('player' ,"{$protocol}player.sidekick.pro/wordpress/js/sk.min.js", array('sidekick') ,get_transient( 'sk_player_version' ));
82
 
83
+ wp_enqueue_style('sk-style' ,"{$protocol}player.sidekick.pro/wordpress/css/sidekick_wordpress.css", null ,get_transient( 'sk_player_version' ));
84
 
85
  wp_enqueue_style('wp-pointer');
86
  wp_enqueue_script('wp-pointer');
90
  add_submenu_page( 'options-general.php', 'Sidekick', 'Sidekick', 'activate_plugins','sidekick', array(&$this,'admin_page'));
91
  }
92
 
93
+ function ajax_save(){
94
+ if (isset($_POST['sk_composer_button']) && $_POST['sk_composer_button'] == "true") {
95
+ update_option( 'sk_composer_button', true );
96
+ } elseif (isset($_POST['sk_composer_button']) && $_POST['sk_composer_button'] == "false") {
97
+ delete_option('sk_composer_button');
98
+ }
99
+ }
100
+
101
  function admin_page(){
102
+ global $SK_PAID_LIBRARY_FILE, $SK_FREE_LIBRARY_FILE ;
103
+
104
  if (isset($_POST['option_page']) && $_POST['option_page'] == 'sk_license') {
105
 
106
  if (isset($_POST['first_name']) && $_POST['first_name'])
131
  die('<script>window.open("' . get_site_url() . '/wp-admin/options-general.php?page=sidekick","_self")</script>');
132
  }
133
 
134
+ if (isset($_POST['sk_autostart_walkthrough_id']) && $_POST['sk_autostart_walkthrough_id']){
135
+ update_option('sk_autostart_walkthrough_id',$_POST['sk_autostart_walkthrough_id']);
136
+ }
137
+
138
+ $activation_id = get_option( 'sk_activation_id' );
139
+ $email = get_option( 'sk_email' );
140
+ $first_name = get_option( 'sk_first_name' );
141
+ $sk_track_data = get_option( 'sk_track_data' );
142
+ $current_user = wp_get_current_user();
143
+ $status = 'Free';
144
+ $error = null;
145
 
146
+ if (isset($SK_PAID_LIBRARY_FILE) && $activation_id) {
147
  $_POST['activation_id'] = $activation_id;
148
  $check_activation = $this->activate(true);
149
+ $status = 'Checking...';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
151
 
152
+ if (!$first_name) $first_name = $current_user->user_firstname;
153
+ if (!$email) $email = $current_user->user_email;
 
 
 
 
 
 
154
 
155
  global $wp_version;
156
  if (version_compare($wp_version, '3.7', '<=')) {
158
  }
159
 
160
  if (!$activation_id) {
161
+ $warn = "You're using the <b>free</b> version of Sidekick, to gain full access to the walkthrough library please <a target='_blank' href='http://www.sidekick.pro/wordpress/modules/wordpress-core-module-premium/?utm_source=plugin&utm_medium=settings&utm_campaign=upgrade_nag'>upgrade</a> to the full module.";
162
  }
163
 
164
  if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])){
177
  <?php endif ?>
178
 
179
  <div class="wrap">
180
+ <?php include('libs/admin_page.php') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  </div>
182
  <?php
183
  }
184
 
185
+ function set_disabled_wts(){
186
+ update_option('sk_disabled_wts',json_encode($_POST['disable_wts']));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }
188
 
189
  function footer(){
190
+ global $current_user, $SK_FREE_LIBRARY_FILE, $SK_PAID_LIBRARY_FILE;
191
+
192
+ require_once('libs/sk_config_data.php');
193
+
194
+ $sk_config_data = new sk_config_data;
195
+ $current_user = wp_get_current_user();
196
+ $sk_just_activated = get_option( 'sk_just_activated' );
197
+ $sk_track_data = get_option( 'sk_track_data' );
198
+ $sk_composer_button = get_option( 'sk_composer_button' );
199
+ $activation_id = (get_option( "sk_activation_id" ) ? get_option( "sk_activation_id" ) : DEFAULT_ACTIVATION_ID);
200
+ $autostart_walkthrough_id = (get_option('sk_autostart_walkthrough_id') ? get_option('sk_autostart_walkthrough_id') : 'null' );
201
+ $theme = wp_get_theme();
202
+ $not_supported_ie = false;
203
+ // $sk_composer_button = true; // BETA
204
+
205
+ $user_role = $sk_config_data->get_user_role();
206
+ $site_url = $sk_config_data->get_domain();
207
+ $installed_plugins = $sk_config_data->get_plugins();
208
+ $disabled_wts = $sk_config_data->get_disabled_wts();
209
+ $current_url = $sk_config_data->get_current_url();
210
+ $post_types = $sk_config_data->get_post_types();
211
+ $taxonomies = $sk_config_data->get_taxonomies();
212
+ $user_data = $sk_config_data->get_user_data();
213
+ $comments = $sk_config_data->get_comments();
214
+ $post_statuses = $sk_config_data->get_post_statuses();
215
+ $post_types_and_statuses = $sk_config_data->get_post_types_and_statuses();
216
+ $number_of_themes = $sk_config_data->get_themes();
217
+
218
+
219
+ $plugin_data = get_plugin_data(plugin_dir_path( dirname( __FILE__ ) ) . 'sidekick/sidekick.php');
220
 
221
  delete_option( 'sk_just_activated' );
 
 
 
 
 
 
 
 
 
 
222
 
223
+ if(preg_match('/(?i)msie [6-8]/',$_SERVER['HTTP_USER_AGENT'])) $not_supported_ie = true;
224
 
225
  ?>
226
 
229
  <script type="text/javascript">
230
 
231
  var sk_config = {
232
+ show_powered_by: true,
233
+ show_powered_by_link: true,
234
+ use_native_controls: false,
235
+ main_soft_name: 'WordPress',
236
+ domain: '<?php echo str_replace("http://","",$_SERVER["SERVER_NAME"]) ?>',
237
+ base_url: '<?php echo site_url() ?>',
238
+ site_url: '<?php echo $site_url ?>',
239
+ main_soft_version: '<?php echo get_bloginfo("version") ?>',
240
+ plugin_url: '<?php echo admin_url("admin.php?page=sidekick") ?>',
241
+ current_url: '<?php echo $current_url ?>',
242
+ theme_version: '<?php echo $theme->Version ?>',
243
+ installed_theme: '<?php echo $theme->Name ?>',
244
+ library_free_file: '<?php echo (isset($SK_FREE_LIBRARY_FILE) ? $SK_FREE_LIBRARY_FILE : '') ?>',
245
+ library_paid_file: '<?php echo (isset($SK_PAID_LIBRARY_FILE) ? $SK_PAID_LIBRARY_FILE : '') ?>',
246
+ library_version: '<?php echo (defined("SK_LIBRARY_VERSION") ? SK_LIBRARY_VERSION : '') ?>',
247
+ plugin_version: '<?php echo $plugin_data["Version"] ?>',
248
+ plugin_version_online: '<?php echo get_transient("sk_player_version") ?>',
249
+ platform_version: '<?php echo get_transient("sk_platform_version") ?>',
250
+ track_data: '<?php echo $sk_track_data ?>',
251
+ user_level: '<?php echo $user_role ?>',
252
+ user_email: '<?php echo $current_user->user_email ?>',
253
+ activation_id: '<?php echo $activation_id ?>',
254
+ autostart_walkthrough_id: <?php echo $autostart_walkthrough_id ?>,
255
+ sk_composer_button: <?php echo ($sk_composer_button ? "true" : "false") ?>,
256
+ just_activated: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
257
+ show_login: <?php echo ($sk_just_activated) ? "true" : "false" ?>,
258
+ installed_plugins: <?php echo $installed_plugins ?>,
259
+ disable_wts: <?php echo $disabled_wts ?>,
260
+ is_multisite: <?php echo (is_multisite()) ? "true" : "false" ?>,
261
+ number_of_themes: <?php echo $number_of_themes ?>,
262
+ <?php echo $post_types ?>
263
+ <?php echo $taxonomies ?>
264
+ <?php echo $user_data ?>
265
+ <?php echo $comments ?>
266
+ <?php echo $post_statuses ?>
267
+ <?php echo $post_types_and_statuses ?>
268
+ sk_autostart_only_once: true,
269
+ auto_open_root_bucket_id: 79
270
+ }
 
 
 
 
271
 
272
+ var skc_config = {
273
+ url: '//p.vod-flowpress.flowpress.netdna-cdn.com/vod/vod-flowpress.flowpress/public_html/composer/',
274
+ apiUrl: '//library.sidekick.pro/api',
275
+ baseSiteUrl: sk_config.base_url
276
+ }
277
 
278
+ console.log('Sidekick Config Setup');
279
 
280
+ </script>
281
+ <?php endif ?>
282
+ <?php
283
+ }
284
 
285
+ function track($data){
286
+ $protocol = $this->protocol();
 
287
 
288
+ $response = wp_remote_post( "{$protocol}library.sidekick.pro/wp-admin/admin-ajax.php", array(
289
+ 'method' => 'POST',
290
+ 'timeout' => 45,
291
+ 'redirection' => 5,
292
+ 'httpversion' => '1.0',
293
+ 'blocking' => true,
294
+ 'headers' => array(),
295
+ 'body' => $data,
296
+ 'cookies' => array()
297
+ )
298
+ );
299
+ }
300
 
301
+ function activate($return = false){
302
+ mlog("activate");
303
+ if ($_POST['activation_id']) {
 
 
 
 
 
 
 
 
304
 
 
305
  $protocol = $this->protocol();
306
 
307
+ $library_file = $protocol . SK_LIBRARY_DOMAIN . "/v" . SK_LIBRARY_VERSION . "/releases/{$_POST['activation_id']}/library.js";
308
+ $ch = curl_init($library_file);
309
+ curl_setopt($ch, CURLOPT_NOBODY, true);
310
+ curl_exec($ch);
311
+ $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
312
+ curl_close($ch);
313
+ update_option('sk_activation_id',$_POST['activation_id']);
314
+ if ($retcode == 200) {
315
+ if ($return)
316
+ return 1;
317
+ die(json_encode(array('success' => 1)));
318
+ } else {
319
+ if ($return)
320
+ return $retcode;
321
+ die(json_encode(array('error' => $retcode)));
322
+ }
323
+ } else {
324
+ die(json_encode(array('error' => 'No Activation ID')));
325
+ }
326
+ }
327
+
328
+ function activate_plugin(){
329
+ update_option( 'sk_firstuse', true );
330
+ update_option( 'sk_do_activation_redirect', true );
331
+ $data = array(
332
+ 'source' => 'plugin',
333
+ 'action' => 'track',
334
+ 'type' => 'activate'
335
  );
336
+ $this->track($data);
337
+ }
338
+
339
+ function check_versions(){
340
+ $protocol = $this->protocol();
341
+
342
+ if ( false === ( $player_version = get_transient( 'sk_player_version' ) ) ) {
343
+ $player_version = file_get_contents("{$protocol}player.sidekick.pro/wordpress/version?v=x");
344
+ set_transient( 'sk_player_version', $player_version, 2 * HOUR_IN_SECONDS );
345
  }
346
 
347
+ if ( false === ( $platform_version = get_transient( 'sk_platform_version' ) ) ) {
348
+ $platform_version = file_get_contents("{$protocol}platform.sidekick.pro/wordpress/version?v=x");
349
+ set_transient( 'sk_platform_version', $platform_version, 2 * HOUR_IN_SECONDS );
350
+ }
351
+ }
352
+
353
+ function redirect(){
354
+ if (get_option('sk_do_activation_redirect', false)) {
355
+ delete_option('sk_do_activation_redirect');
356
+ $siteurl = get_site_url();
357
+ wp_redirect($siteurl . "/wp-admin/options-general.php?page=sidekick");
358
+ die();
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  }
360
+ }
361
 
362
+ function deactivate_plugin(){
363
+ $sk_track_data = get_option( 'sk_track_data' );
364
+ if ($sk_track_data) {
365
  $data = array(
366
  'source' => 'plugin',
367
  'action' => 'track',
368
+ 'type' => 'deactivate',
369
+ 'user' => get_option( "activation_id" )
370
  );
371
  $this->track($data);
372
+ ?>
373
+ <script type="text/javascript">
374
+ window._gaq = window._gaq || [];
375
+ window._gaq.push(['sk._setAccount', 'UA-39283622-1']);
376
+
377
+ (function() {
378
+ var ga_wpu = document.createElement('script'); ga_sk.type = 'text/javascript'; ga_sk.async = true;
379
+ ga_sk.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
380
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga_wpu, s);
381
+ })();
382
+ window._gaq.push(['sk._trackEvent', 'Plugin - Deactivate', '', <?php echo plugin_version ?>, 0,true]);
383
+ </script>
384
+ <?php
385
  }
386
+ delete_option( 'sk_activation_id' );
387
+ delete_option( 'sk_first_name' );
388
+ delete_option( 'sk_email' );
389
+ delete_option( 'sk_activated' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  }
391
+ }
392
+
393
+ $sidekick = new Sidekick;
394
+ register_activation_hook( __FILE__, array($sidekick,'activate_plugin') );
395
+ register_deactivation_hook( __FILE__, array($sidekick,'deactivate_plugin') );
396
 
397
+ add_action('admin_menu', array($sidekick,'setup_menu'));
398
+ add_action('admin_init', array($sidekick,'redirect'));
399
+ add_action('wp_ajax_sk_activate', array($sidekick,'activate'));
400
+ add_action('wp_ajax_sk_save', array($sidekick,'ajax_save'));
401
 
402
+ if (isset($_POST['disable_wts'])) {
403
+ $sidekick->set_disabled_wts();
404
+ }
405
 
406
+ if (!defined('SK_PLUGIN_DEGBUG'))
407
+ require_once('sk_init.php');
408
 
409
+ if (!(isset($_GET['tab']) && $_GET['tab'] == 'plugin-information') && !defined('IFRAME_REQUEST')) {
410
+ add_action('admin_footer', array($sidekick,'footer'));
411
+ add_action('customize_controls_print_footer_scripts', array($sidekick,'footer'));
412
+ }