sideshow 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.bowerrc +3 -0
- data/.csslintrc +37 -0
- data/.editorconfig +27 -0
- data/.gitattributes +1 -0
- data/.gitignore +23 -0
- data/BUILDING.md +4 -0
- data/CHANGELOG.md +47 -0
- data/Gulpfile.js +404 -0
- data/LICENSE +191 -0
- data/README.md +342 -0
- data/VERSION +1 -0
- data/bower.json +61 -0
- data/distr/dependencies/jazz.min.js +8 -0
- data/distr/dependencies/jquery.min.js +5 -0
- data/distr/dependencies/pagedown.min.js +1 -0
- data/distr/fonts/open-sans-family/opensans-bold.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-bold.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-bold.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-bold.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-bolditalic.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-bolditalic.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-bolditalic.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-bolditalic.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabold.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabold.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-extrabold.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabold.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabolditalic.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabolditalic.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-extrabolditalic.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-extrabolditalic.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-italic.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-italic.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-italic.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-italic.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-light.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-light.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-light.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-light.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-lightitalic.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-lightitalic.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-lightitalic.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-lightitalic.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-regular.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-regular.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-regular.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-regular.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-semibold.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-semibold.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-semibold.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-semibold.woff +0 -0
- data/distr/fonts/open-sans-family/opensans-semibolditalic.eot +0 -0
- data/distr/fonts/open-sans-family/opensans-semibolditalic.svg +1825 -0
- data/distr/fonts/open-sans-family/opensans-semibolditalic.ttf +0 -0
- data/distr/fonts/open-sans-family/opensans-semibolditalic.woff +0 -0
- data/distr/fonts/sideshow-fontface.min.css +1 -0
- data/distr/fonts/sideshow-icons/sideshow-icons.eot +0 -0
- data/distr/fonts/sideshow-icons/sideshow-icons.svg +16 -0
- data/distr/fonts/sideshow-icons/sideshow-icons.ttf +0 -0
- data/distr/fonts/sideshow-icons/sideshow-icons.woff +0 -0
- data/distr/sideshow.js +2510 -0
- data/distr/sideshow.min.js +10 -0
- data/distr/stylesheets/sideshow.min.css +1 -0
- data/docs/api.js +29 -0
- data/docs/assets/css/external-small.png +0 -0
- data/docs/assets/css/logo.png +0 -0
- data/docs/assets/css/main.css +783 -0
- data/docs/assets/favicon.png +0 -0
- data/docs/assets/img/spinner.gif +0 -0
- data/docs/assets/index.html +10 -0
- data/docs/assets/js/api-filter.js +52 -0
- data/docs/assets/js/api-list.js +251 -0
- data/docs/assets/js/api-search.js +98 -0
- data/docs/assets/js/apidocs.js +370 -0
- data/docs/assets/js/yui-prettify.js +17 -0
- data/docs/assets/vendor/prettify/CHANGES.html +130 -0
- data/docs/assets/vendor/prettify/COPYING +202 -0
- data/docs/assets/vendor/prettify/README.html +203 -0
- data/docs/assets/vendor/prettify/prettify-min.css +1 -0
- data/docs/assets/vendor/prettify/prettify-min.js +1 -0
- data/docs/classes/Arrow.html +541 -0
- data/docs/classes/Arrows.html +805 -0
- data/docs/classes/ControlVariables.html +1005 -0
- data/docs/classes/DetailsPanel.html +672 -0
- data/docs/classes/FadableItem.html +613 -0
- data/docs/classes/HidableItem.html +495 -0
- data/docs/classes/Mask.CloseButton.html +706 -0
- data/docs/classes/Mask.CompositeMask.html +721 -0
- data/docs/classes/Mask.CornerPart.html +613 -0
- data/docs/classes/Mask.Part.html +395 -0
- data/docs/classes/Mask.Polling.html +809 -0
- data/docs/classes/Mask.Subject.html +199 -0
- data/docs/classes/Mask.SubjectMask.html +417 -0
- data/docs/classes/Mask.WizardMenu.html +1401 -0
- data/docs/classes/SS.html +267 -0
- data/docs/classes/SSException.html +203 -0
- data/docs/classes/Screen.html +363 -0
- data/docs/classes/StepDescription.html +1025 -0
- data/docs/classes/StepDescriptionNextButton.html +746 -0
- data/docs/classes/VisualItem.html +339 -0
- data/docs/classes/Wizard.html +967 -0
- data/docs/files/c +0 -0
- data/docs/index.html +162 -0
- data/example.html +81 -0
- data/examples/images/clemenza.jpg +0 -0
- data/examples/images/doc_brown.png +0 -0
- data/examples/images/forkme.png +0 -0
- data/examples/images/fortes-logo.png +0 -0
- data/examples/images/sideshow-logo.png +0 -0
- data/examples/images/sideshow-logo.svg +155 -0
- data/examples/scripts/sideshow.config.js +2 -0
- data/examples/scripts/tutorials/introducing_sideshow.js +259 -0
- data/examples/stylesheets/example.min.css +1 -0
- data/examples/stylesheets/styl/example.styl +272 -0
- data/gulp/config.js +0 -0
- data/gulp/extensions/gulp-html-extend.js +151 -0
- data/gulp/tasks/.gitkeep +0 -0
- data/icons/iconfont.zip +0 -0
- data/package.json +56 -0
- data/sideshow.gemspec +20 -0
- data/sideshow.nuspec +72 -0
- data/sideshow.sublime-project +22 -0
- data/src/copyright_info.js +8 -0
- data/src/general/config.js +42 -0
- data/src/general/dictionary.js +42 -0
- data/src/general/exception.js +15 -0
- data/src/general/global_object.js +287 -0
- data/src/general/polling.js +151 -0
- data/src/general/screen.js +39 -0
- data/src/general/utility_functions.js +88 -0
- data/src/general/variables.js +42 -0
- data/src/interface_itens/fadable_item.js +55 -0
- data/src/interface_itens/hidable_item.js +32 -0
- data/src/interface_itens/visual_item.js +42 -0
- data/src/main.js +52 -0
- data/src/mask/composite_mask.js +193 -0
- data/src/mask/composite_mask_corner_part.js +105 -0
- data/src/mask/composite_mask_part.js +51 -0
- data/src/mask/mask.js +6 -0
- data/src/mask/subject_mask.js +34 -0
- data/src/step/arrow.js +88 -0
- data/src/step/arrows.js +155 -0
- data/src/step/step_description.js +165 -0
- data/src/step/step_description_next_button.js +55 -0
- data/src/step/step_details_panel.js +87 -0
- data/src/step/subject.js +100 -0
- data/src/wizard/wizard.js +395 -0
- data/src/wizard/wizard_control_variables.js +95 -0
- data/src/wizard/wizard_menu.js +101 -0
- data/stylesheets/_animations.styl +87 -0
- data/stylesheets/_font-face.styl +135 -0
- data/stylesheets/_icons.styl +27 -0
- data/stylesheets/_layout.styl +362 -0
- data/stylesheets/_mixins.styl +52 -0
- data/stylesheets/_variables.styl +35 -0
- data/stylesheets/sideshow-fontface.styl +4 -0
- data/stylesheets/sideshow.styl +7 -0
- data/yuidoc.json +15 -0
- metadata +246 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
/**
|
2
|
+
Controls the polling functions needed by Sideshow
|
3
|
+
|
4
|
+
@class Polling
|
5
|
+
@static
|
6
|
+
**/
|
7
|
+
var Polling = {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
The polling functions queue
|
11
|
+
|
12
|
+
@@field queue
|
13
|
+
@type Object
|
14
|
+
@static
|
15
|
+
**/
|
16
|
+
Polling.queue = [];
|
17
|
+
|
18
|
+
/**
|
19
|
+
A flag that controls if the polling is locked
|
20
|
+
|
21
|
+
@@field lock
|
22
|
+
@type boolean
|
23
|
+
@static
|
24
|
+
**/
|
25
|
+
Polling.lock = false;
|
26
|
+
|
27
|
+
/**
|
28
|
+
Pushes a polling function in the queue
|
29
|
+
|
30
|
+
@method enqueue
|
31
|
+
@static
|
32
|
+
**/
|
33
|
+
Polling.enqueue = function() {
|
34
|
+
var firstArg = arguments[0];
|
35
|
+
var fn;
|
36
|
+
var name = "";
|
37
|
+
|
38
|
+
if(typeof firstArg == "function")
|
39
|
+
fn = firstArg;
|
40
|
+
else{
|
41
|
+
name = arguments[0];
|
42
|
+
fn = arguments[1];
|
43
|
+
}
|
44
|
+
|
45
|
+
if (this.getFunctionIndex(fn) < 0
|
46
|
+
&& (name === "" || this.getFunctionIndex(name) < 0)) {
|
47
|
+
this.queue.push({ name: name, fn: fn, enabled: true });
|
48
|
+
} else
|
49
|
+
throw new SSException("301", "The function is already in the polling queue.");
|
50
|
+
};
|
51
|
+
|
52
|
+
/**
|
53
|
+
Removes a polling function from the queue
|
54
|
+
|
55
|
+
@method dequeue
|
56
|
+
@static
|
57
|
+
**/
|
58
|
+
Polling.dequeue = function() {
|
59
|
+
this.queue.splice(this.getFunctionIndex(arguments[0]), 1);
|
60
|
+
};
|
61
|
+
|
62
|
+
/**
|
63
|
+
Enables an specific polling function
|
64
|
+
|
65
|
+
@method enable
|
66
|
+
@static
|
67
|
+
**/
|
68
|
+
Polling.enable = function(){
|
69
|
+
this.queue[this.getFunctionIndex(arguments[0])].enabled = true;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
Disables an specific polling function, but preserving it in the polling queue
|
74
|
+
|
75
|
+
@method disable
|
76
|
+
@static
|
77
|
+
**/
|
78
|
+
Polling.disable = function(){
|
79
|
+
this.queue[this.getFunctionIndex(arguments[0])].enabled = false;
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
Gets the position of a polling function in the queue based on its name or the function itself
|
84
|
+
|
85
|
+
@method getFunctionIndex
|
86
|
+
@static
|
87
|
+
**/
|
88
|
+
Polling.getFunctionIndex = function(){
|
89
|
+
var firstArg = arguments[0];
|
90
|
+
|
91
|
+
if(typeof firstArg == "function")
|
92
|
+
return this.queue.map(function(p){ return p.fn; }).indexOf(firstArg);
|
93
|
+
else if(typeof firstArg == "string")
|
94
|
+
return this.queue.map(function(p){ return p.name; }).indexOf(firstArg);
|
95
|
+
|
96
|
+
throw new SSException("302", "Invalid argument for getFunctionIndex method. Expected a string (the polling function name) or a function (the polling function itself).");
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
Unlocks the polling and starts the checking process
|
101
|
+
|
102
|
+
@method start
|
103
|
+
@static
|
104
|
+
**/
|
105
|
+
Polling.start = function() {
|
106
|
+
this.lock = false;
|
107
|
+
this.doPolling();
|
108
|
+
};
|
109
|
+
|
110
|
+
/**
|
111
|
+
Stops the polling process
|
112
|
+
|
113
|
+
@method stop
|
114
|
+
@static
|
115
|
+
**/
|
116
|
+
Polling.stop = function() {
|
117
|
+
this.lock = true;
|
118
|
+
};
|
119
|
+
|
120
|
+
/**
|
121
|
+
Clear the polling queue
|
122
|
+
|
123
|
+
@method clear
|
124
|
+
@static
|
125
|
+
**/
|
126
|
+
Polling.clear = function() {
|
127
|
+
var lock = this.lock;
|
128
|
+
|
129
|
+
this.lock = true;
|
130
|
+
this.queue = [];
|
131
|
+
this.lock = lock;
|
132
|
+
};
|
133
|
+
|
134
|
+
/**
|
135
|
+
Starts the polling process
|
136
|
+
|
137
|
+
@method doPolling
|
138
|
+
@static
|
139
|
+
**/
|
140
|
+
Polling.doPolling = function() {
|
141
|
+
if (!this.lock) {
|
142
|
+
//Using timeout to avoid the queue to not complete in a cycle
|
143
|
+
setTimeout(function() {
|
144
|
+
for (var fn = 0; fn < Polling.queue.length; fn++) {
|
145
|
+
var pollingFunction = Polling.queue[fn];
|
146
|
+
pollingFunction.enabled && pollingFunction.fn();
|
147
|
+
}
|
148
|
+
Polling.doPolling();
|
149
|
+
}, pollingDuration);
|
150
|
+
}
|
151
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
Represents the current available area in the browser
|
3
|
+
|
4
|
+
@class Screen
|
5
|
+
@static
|
6
|
+
**/
|
7
|
+
var Screen = {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
Object holding dimension information for the screen
|
11
|
+
|
12
|
+
@@field
|
13
|
+
@static
|
14
|
+
@type Object
|
15
|
+
**/
|
16
|
+
Screen.dimension = {};
|
17
|
+
|
18
|
+
/**
|
19
|
+
Checks if the screen dimension information has changed
|
20
|
+
|
21
|
+
@method hasChanged
|
22
|
+
@static
|
23
|
+
@return boolean
|
24
|
+
**/
|
25
|
+
Screen.hasChanged = function() {
|
26
|
+
return ($window.width() !== this.dimension.width) ||
|
27
|
+
($window.height() !== this.dimension.height);
|
28
|
+
};
|
29
|
+
|
30
|
+
/**
|
31
|
+
Updates the dimension information for the screen
|
32
|
+
|
33
|
+
@method updateInfo
|
34
|
+
@static
|
35
|
+
**/
|
36
|
+
Screen.updateInfo = function() {
|
37
|
+
this.dimension.width = $window.width();
|
38
|
+
this.dimension.height = $window.height();
|
39
|
+
};
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/**
|
2
|
+
Shows a warning in a pre-defined format
|
3
|
+
|
4
|
+
@@function showWarning
|
5
|
+
@param {String} code The warning code
|
6
|
+
@param {String} message The warning message
|
7
|
+
**/
|
8
|
+
function showWarning(code, message) {
|
9
|
+
console.warn("[SIDESHOW_W#" + ("00000000" + code).substr(-8) + "] " + message);
|
10
|
+
}
|
11
|
+
|
12
|
+
/**
|
13
|
+
Parses a string in the format "#px" in a number
|
14
|
+
|
15
|
+
@@function parsePxValue
|
16
|
+
@param {String} value A value with/without a px unit
|
17
|
+
@return Number The number value without unit
|
18
|
+
**/
|
19
|
+
function parsePxValue(value) {
|
20
|
+
if (value.constructor !== String) return value;
|
21
|
+
var br = value === "" ? "0" : value;
|
22
|
+
return +br.replace("px", "");
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
Gets a string from the dictionary in the current language
|
27
|
+
|
28
|
+
@@function getString
|
29
|
+
@param {Object} stringKeyValuePair A string key-value pair in dictionary
|
30
|
+
@return String The string value in the current language
|
31
|
+
**/
|
32
|
+
function getString(stringKeyValuePair) {
|
33
|
+
if (!(SS.config.language in stringKeyValuePair)) {
|
34
|
+
showWarning("2001", "String not found for the selected language, getting the first available.");
|
35
|
+
return stringKeyValuePair[Object.keys(stringKeyValuePair)[0]];
|
36
|
+
}
|
37
|
+
|
38
|
+
return stringKeyValuePair[SS.config.language];
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
Registers hotkeys to be used when running Sideshow
|
43
|
+
|
44
|
+
@@function registerInnerHotkeys
|
45
|
+
**/
|
46
|
+
function registerInnerHotkeys() {
|
47
|
+
$document.keyup(innerHotkeysListener);
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
Unregisters hotkeys used when running Sideshow
|
52
|
+
|
53
|
+
@@function Unregisters
|
54
|
+
**/
|
55
|
+
function unregisterInnerHotkeys() {
|
56
|
+
$document.unbind("keyup", innerHotkeysListener);
|
57
|
+
}
|
58
|
+
|
59
|
+
function innerHotkeysListener(e) {
|
60
|
+
//Esc or F1
|
61
|
+
if (e.keyCode == 27 || e.keyCode == 112) SS.close();
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
Registers global hotkeys
|
66
|
+
|
67
|
+
@@function registerGlobalHotkeys
|
68
|
+
**/
|
69
|
+
function registerGlobalHotkeys() {
|
70
|
+
$document.keyup(function(e) {
|
71
|
+
//F2
|
72
|
+
if (e.keyCode == 113) {
|
73
|
+
if (e.shiftKey) SS.start({
|
74
|
+
listAll: true
|
75
|
+
});
|
76
|
+
else SS.start();
|
77
|
+
}
|
78
|
+
});
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
Removes nodes created by Sideshow (except mask, which remains due to performance reasons when recalling Sideshow)
|
83
|
+
|
84
|
+
@@function removeDOMGarbage
|
85
|
+
**/
|
86
|
+
function removeDOMGarbage() {
|
87
|
+
$("[class*=\"sideshow\"]").not(".sideshow-mask-part, .sideshow-mask-corner-part, .sideshow-subject-mask").remove();
|
88
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
var globalObjectName = "Sideshow",
|
2
|
+
$window,
|
3
|
+
$body,
|
4
|
+
$document,
|
5
|
+
pollingDuration = 150,
|
6
|
+
longAnimationDuration = 600,
|
7
|
+
|
8
|
+
/**
|
9
|
+
The main class for Sideshow
|
10
|
+
|
11
|
+
@class SS
|
12
|
+
@static
|
13
|
+
**/
|
14
|
+
SS = {
|
15
|
+
/**
|
16
|
+
The current Sideshow version
|
17
|
+
|
18
|
+
@property VERSION
|
19
|
+
@type String
|
20
|
+
**/
|
21
|
+
get VERSION() {
|
22
|
+
return "0.4.1";
|
23
|
+
}
|
24
|
+
},
|
25
|
+
|
26
|
+
controlVariables = [],
|
27
|
+
flags = {
|
28
|
+
lockMaskUpdate: false,
|
29
|
+
changingStep: false,
|
30
|
+
skippingStep: false,
|
31
|
+
running: false
|
32
|
+
},
|
33
|
+
wizards = [],
|
34
|
+
currentWizard,
|
35
|
+
|
36
|
+
/**
|
37
|
+
Possible statuses for an animation
|
38
|
+
|
39
|
+
@@enum AnimationStatus
|
40
|
+
**/
|
41
|
+
AnimationStatus = jazz.Enum("VISIBLE", "FADING_IN", "FADING_OUT", "NOT_DISPLAYED", "NOT_RENDERED", "TRANSPARENT");
|
42
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/**
|
2
|
+
A visual item which holds fading in and out capabilities
|
3
|
+
|
4
|
+
@class FadableItem
|
5
|
+
@@abstract
|
6
|
+
@extends HidableItem
|
7
|
+
**/
|
8
|
+
var FadableItem = jazz.Class().extending(HidableItem).abstract;
|
9
|
+
|
10
|
+
/**
|
11
|
+
Does a fade in transition for the visual item
|
12
|
+
|
13
|
+
@method fadeIn
|
14
|
+
**/
|
15
|
+
FadableItem.method("fadeIn", function(callback, linearTimingFunction) {
|
16
|
+
var item = this;
|
17
|
+
item.status = AnimationStatus.FADING_IN;
|
18
|
+
|
19
|
+
if (!item.$el) this.render();
|
20
|
+
if (linearTimingFunction) item.$el.css("animation-timing-function", "linear");
|
21
|
+
item.$el.removeClass("sideshow-hidden");
|
22
|
+
|
23
|
+
//Needed hack to get CSS transition to work properly
|
24
|
+
setTimeout(function() {
|
25
|
+
item.$el.removeClass("sideshow-invisible");
|
26
|
+
|
27
|
+
setTimeout(function() {
|
28
|
+
item.status = AnimationStatus.VISIBLE;
|
29
|
+
if (linearTimingFunction) item.$el.css("animation-timing-function", "ease");
|
30
|
+
if (callback) callback();
|
31
|
+
}, longAnimationDuration);
|
32
|
+
}, 20); //<-- Yeap, I'm really scheduling a timeout for 20 milliseconds... this is a dirty trick =)
|
33
|
+
});
|
34
|
+
|
35
|
+
/**
|
36
|
+
Does a fade out transition for the visual item
|
37
|
+
|
38
|
+
@method fadeOut
|
39
|
+
**/
|
40
|
+
FadableItem.method("fadeOut", function(callback, linearTimingFunction) {
|
41
|
+
var item = this;
|
42
|
+
if (item.status != AnimationStatus.NOT_RENDERED) {
|
43
|
+
item.status = AnimationStatus.FADING_OUT;
|
44
|
+
|
45
|
+
if (linearTimingFunction) item.$el.css("animation-timing-function", "linear");
|
46
|
+
item.$el.addClass("sideshow-invisible");
|
47
|
+
|
48
|
+
setTimeout(function() {
|
49
|
+
item.$el.addClass("sideshow-hidden");
|
50
|
+
item.status = AnimationStatus.NOT_DISPLAYED;
|
51
|
+
if (linearTimingFunction) item.$el.css("animation-timing-function", "ease");
|
52
|
+
if (callback) callback();
|
53
|
+
}, longAnimationDuration);
|
54
|
+
}
|
55
|
+
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
A visual item which can be shown and hidden
|
3
|
+
|
4
|
+
@class HidableItem
|
5
|
+
@@abstract
|
6
|
+
@extends VisualItem
|
7
|
+
**/
|
8
|
+
var HidableItem = jazz.Class().extending(VisualItem).abstract;
|
9
|
+
|
10
|
+
/**
|
11
|
+
Shows the visual item
|
12
|
+
|
13
|
+
@method show
|
14
|
+
@param {boolean} displayButKeepTransparent The item will hold space but keep invisible
|
15
|
+
**/
|
16
|
+
HidableItem.method("show", function(displayButKeepTransparent) {
|
17
|
+
if (!this.$el) this.render();
|
18
|
+
if (!displayButKeepTransparent) this.$el.removeClass("sideshow-invisible");
|
19
|
+
this.$el.removeClass("sideshow-hidden");
|
20
|
+
this.status = AnimationStatus.VISIBLE;
|
21
|
+
});
|
22
|
+
|
23
|
+
/**
|
24
|
+
Hides the visual item
|
25
|
+
|
26
|
+
@method hide
|
27
|
+
**/
|
28
|
+
HidableItem.method("hide", function(keepHoldingSpace) {
|
29
|
+
if (!keepHoldingSpace) this.$el.addClass("sideshow-hidden");
|
30
|
+
this.$el.addClass("sideshow-invisible");
|
31
|
+
this.status = AnimationStatus.NOT_DISPLAYED;
|
32
|
+
});
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
A visual item
|
3
|
+
|
4
|
+
@class VisualItem
|
5
|
+
@@abstract
|
6
|
+
**/
|
7
|
+
var VisualItem = jazz.Class().abstract;
|
8
|
+
|
9
|
+
/**
|
10
|
+
The jQuery wrapped DOM element for the visual item
|
11
|
+
|
12
|
+
@@field $el
|
13
|
+
@type Object
|
14
|
+
**/
|
15
|
+
VisualItem.field("$el");
|
16
|
+
|
17
|
+
/**
|
18
|
+
The jQuery wrapped DOM element for the visual item
|
19
|
+
|
20
|
+
@@field $el
|
21
|
+
@type AnimationStatus
|
22
|
+
**/
|
23
|
+
VisualItem.field("status", AnimationStatus.NOT_RENDERED);
|
24
|
+
|
25
|
+
/**
|
26
|
+
Renders the item's DOM object
|
27
|
+
|
28
|
+
@method render
|
29
|
+
**/
|
30
|
+
VisualItem.method("render", function($parent) {
|
31
|
+
($parent || $body).append(this.$el);
|
32
|
+
this.status = AnimationStatus.NOT_DISPLAYED;
|
33
|
+
});
|
34
|
+
|
35
|
+
/**
|
36
|
+
Destroys the item's DOM object
|
37
|
+
|
38
|
+
@method destroy
|
39
|
+
**/
|
40
|
+
VisualItem.method("destroy", function() {
|
41
|
+
this.$el.remove();
|
42
|
+
});
|
data/src/main.js
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
;(function(global, $, jazz, markdown){
|
2
|
+
(function(name, module){
|
3
|
+
var ss = module();
|
4
|
+
|
5
|
+
if (typeof define === 'function' && define.amd){
|
6
|
+
define(module);
|
7
|
+
} else {
|
8
|
+
global[name] = ss;
|
9
|
+
}
|
10
|
+
})('sideshow', function(){
|
11
|
+
//jQuery is needed
|
12
|
+
if ($ === undefined) throw new SSException("2", "jQuery is required for Sideshow to work.");
|
13
|
+
|
14
|
+
//Jazz is needed
|
15
|
+
if (jazz === undefined) throw new SSException("3", "Jazz is required for Sideshow to work.");
|
16
|
+
|
17
|
+
//Pagedown (the Markdown parser used by Sideshow) is needed
|
18
|
+
if (markdown === undefined) throw new SSException("4", "Pagedown (the Markdown parser used by Sideshow) is required for Sideshow to work.");
|
19
|
+
|
20
|
+
//=include general/variables.js
|
21
|
+
//=include general/exception.js
|
22
|
+
//=include general/utility_functions.js
|
23
|
+
//=include general/dictionary.js
|
24
|
+
//=include general/config.js
|
25
|
+
//=include wizard/wizard_control_variables.js
|
26
|
+
//=include interface_itens/visual_item.js
|
27
|
+
//=include interface_itens/hidable_item.js
|
28
|
+
//=include interface_itens/fadable_item.js
|
29
|
+
//=include wizard/wizard.js
|
30
|
+
//=include step/step_details_panel.js
|
31
|
+
//=include step/arrows.js
|
32
|
+
//=include step/arrow.js
|
33
|
+
//=include step/step_description.js
|
34
|
+
//=include step/step_description_next_button.js
|
35
|
+
//=include general/screen.js
|
36
|
+
//=include step/subject.js
|
37
|
+
//=include mask/mask.js
|
38
|
+
//=include mask/subject_mask.js
|
39
|
+
//=include mask/composite_mask.js
|
40
|
+
//=include mask/composite_mask_part.js
|
41
|
+
//=include mask/composite_mask_corner_part.js
|
42
|
+
//=include general/polling.js
|
43
|
+
//=include wizard/wizard_menu.js
|
44
|
+
//=include general/global_object.js
|
45
|
+
|
46
|
+
//Tries to register the Global Access Point
|
47
|
+
if (global[globalObjectName] === undefined) {
|
48
|
+
global[globalObjectName] = SS;
|
49
|
+
} else
|
50
|
+
throw new SSException("1", "The global access point \"Sideshow\" is already being used.");
|
51
|
+
});
|
52
|
+
})(this, jQuery, Jazz, Markdown);
|
@@ -0,0 +1,193 @@
|
|
1
|
+
/**
|
2
|
+
Controls the mask surrounds the subject (the step focussed area)
|
3
|
+
|
4
|
+
@class CompositeMask
|
5
|
+
@@singleton
|
6
|
+
**/
|
7
|
+
Mask.CompositeMask = jazz.Class().extending(FadableItem).singleton;
|
8
|
+
|
9
|
+
/**
|
10
|
+
Initializes the composite mask
|
11
|
+
|
12
|
+
@method init
|
13
|
+
**/
|
14
|
+
Mask.CompositeMask.method("init", function() {
|
15
|
+
var mask = this;
|
16
|
+
["top", "left", "right", "bottom"].forEach(function(d) {
|
17
|
+
mask.parts[d] = Mask.CompositeMask.Part.build();
|
18
|
+
});
|
19
|
+
["leftTop", "rightTop", "leftBottom", "rightBottom"].forEach(function(d) {
|
20
|
+
mask.parts[d] = Mask.CompositeMask.CornerPart.build();
|
21
|
+
});
|
22
|
+
});
|
23
|
+
|
24
|
+
/**
|
25
|
+
The parts composing the mask
|
26
|
+
|
27
|
+
@@field parts
|
28
|
+
@type Object
|
29
|
+
**/
|
30
|
+
Mask.CompositeMask.field("parts", {});
|
31
|
+
|
32
|
+
/**
|
33
|
+
Renders the composite mask
|
34
|
+
|
35
|
+
@method render
|
36
|
+
**/
|
37
|
+
Mask.CompositeMask.method("render", function() {
|
38
|
+
var mask = this;
|
39
|
+
for (var p in this.parts) {
|
40
|
+
var part = this.parts[p];
|
41
|
+
if (part.render) part.render();
|
42
|
+
}
|
43
|
+
this.$el = $(".sideshow-mask-part, .sideshow-mask-corner-part");
|
44
|
+
// if(!this.$el || this.$el.length === 0) this.$el = $(".sideshow-mask-part, .sideshow-mask-corner-part");
|
45
|
+
Mask.SubjectMask.singleInstance.render();
|
46
|
+
["leftTop", "rightTop", "leftBottom", "rightBottom"].forEach(function(d) {
|
47
|
+
mask.parts[d].$el.addClass(d);
|
48
|
+
});
|
49
|
+
this.status = AnimationStatus.NOT_DISPLAYED;
|
50
|
+
});
|
51
|
+
|
52
|
+
/**
|
53
|
+
Checks if the subject is fully visible, if not, scrolls 'til it became fully visible
|
54
|
+
|
55
|
+
@method scrollIfNecessary
|
56
|
+
@param {Object} position An object representing the positioning info for the mask
|
57
|
+
@param {Object} dimension An object representing the dimension info for the mask
|
58
|
+
**/
|
59
|
+
Mask.CompositeMask.method("scrollIfNecessary", function(position, dimension) {
|
60
|
+
function doSmoothScroll(scrollTop, callback){
|
61
|
+
$("body,html").animate({
|
62
|
+
scrollTop: scrollTop
|
63
|
+
}, 300, callback);
|
64
|
+
}
|
65
|
+
|
66
|
+
if(!Subject.isSubjectVisible(position, dimension)) {
|
67
|
+
var description = StepDescription.singleInstance;
|
68
|
+
var y = dimension.height > ($window.height() - 50) ? position.y : position.y - 25;
|
69
|
+
y += $window.scrollTop();
|
70
|
+
|
71
|
+
doSmoothScroll(y, function(){
|
72
|
+
setTimeout(function(){
|
73
|
+
DetailsPanel.singleInstance.positionate();
|
74
|
+
description.positionate();
|
75
|
+
description.fadeIn();
|
76
|
+
}, 300);
|
77
|
+
});
|
78
|
+
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
return false;
|
82
|
+
});
|
83
|
+
|
84
|
+
/**
|
85
|
+
Updates the positioning and dimension of each part composing the whole mask, according to the subject coordinates
|
86
|
+
|
87
|
+
@method update
|
88
|
+
@param {Object} position An object representing the positioning info for the mask
|
89
|
+
@param {Object} dimension An object representing the dimension info for the mask
|
90
|
+
@param {Object} borderRadius An object representing the borderRadius info for the mask
|
91
|
+
**/
|
92
|
+
Mask.CompositeMask.method("update", function(position, dimension, borderRadius) {
|
93
|
+
Mask.SubjectMask.singleInstance.update(position, dimension, borderRadius);
|
94
|
+
//Aliases
|
95
|
+
var left = position.x,
|
96
|
+
top = position.y,
|
97
|
+
width = dimension.width,
|
98
|
+
height = dimension.height,
|
99
|
+
br = borderRadius;
|
100
|
+
|
101
|
+
//Updates the divs surrounding the subject
|
102
|
+
this.parts.top.update({
|
103
|
+
x: 0,
|
104
|
+
y: 0
|
105
|
+
}, {
|
106
|
+
width: $window.width(),
|
107
|
+
height: top
|
108
|
+
});
|
109
|
+
this.parts.left.update({
|
110
|
+
x: 0,
|
111
|
+
y: top
|
112
|
+
}, {
|
113
|
+
width: left,
|
114
|
+
height: height
|
115
|
+
});
|
116
|
+
this.parts.right.update({
|
117
|
+
x: left + width,
|
118
|
+
y: top
|
119
|
+
}, {
|
120
|
+
width: $window.width() - (left + width),
|
121
|
+
height: height
|
122
|
+
});
|
123
|
+
this.parts.bottom.update({
|
124
|
+
x: 0,
|
125
|
+
y: top + height
|
126
|
+
}, {
|
127
|
+
width: $window.width(),
|
128
|
+
height: $window.height() - (top + height)
|
129
|
+
});
|
130
|
+
|
131
|
+
//Updates the Rounded corners
|
132
|
+
this.parts.leftTop.update({
|
133
|
+
x: left,
|
134
|
+
y: top
|
135
|
+
}, br.leftTop);
|
136
|
+
this.parts.rightTop.update({
|
137
|
+
x: left + width - br.rightTop,
|
138
|
+
y: top
|
139
|
+
}, br.rightTop);
|
140
|
+
this.parts.leftBottom.update({
|
141
|
+
x: left,
|
142
|
+
y: top + height - br.leftBottom
|
143
|
+
}, br.leftBottom);
|
144
|
+
this.parts.rightBottom.update({
|
145
|
+
x: left + width - br.rightBottom,
|
146
|
+
y: top + height - br.rightBottom
|
147
|
+
}, br.rightBottom);
|
148
|
+
});
|
149
|
+
|
150
|
+
/**
|
151
|
+
A Polling function to check if subject coordinates has changed
|
152
|
+
|
153
|
+
@method pollForSubjectChanges
|
154
|
+
**/
|
155
|
+
Mask.CompositeMask.method("pollForSubjectChanges", function() {
|
156
|
+
if (!flags.lockMaskUpdate) {
|
157
|
+
if (currentWizard && currentWizard.currentStep.subject) {
|
158
|
+
var subject = $(currentWizard.currentStep.subject);
|
159
|
+
if (Subject.obj[0] !== subject[0]) SS.setSubject(subject, true);
|
160
|
+
}
|
161
|
+
|
162
|
+
if (Subject.hasChanged()) {
|
163
|
+
Subject.updateInfo();
|
164
|
+
this.update(Subject.position, Subject.dimension, Subject.borderRadius);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
});
|
168
|
+
|
169
|
+
/**
|
170
|
+
A Polling function to check if screen dimension has changed
|
171
|
+
|
172
|
+
@method pollForScreenChanges
|
173
|
+
**/
|
174
|
+
Mask.CompositeMask.method("pollForScreenChanges", function() {
|
175
|
+
if (Screen.hasChanged()) {
|
176
|
+
Screen.updateInfo();
|
177
|
+
this.update(Subject.position, Subject.dimension, Subject.borderRadius);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
|
181
|
+
/**
|
182
|
+
A part composing the mask
|
183
|
+
|
184
|
+
@class Part
|
185
|
+
@@initializer
|
186
|
+
@param {Object} position The positioning information
|
187
|
+
@param {Object} dimension The dimension information
|
188
|
+
**/
|
189
|
+
Mask.CompositeMask.Part = jazz.Class(function(position, dimension) {
|
190
|
+
this.position = position;
|
191
|
+
this.dimension = dimension;
|
192
|
+
}).extending(VisualItem);
|
193
|
+
|