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,259 @@
|
|
1
|
+
//A Sideshow Tutorial Example
|
2
|
+
//This tutorial introduces the Sideshow basics to the newcomer
|
3
|
+
|
4
|
+
Sideshow.registerWizard({
|
5
|
+
name: "introducing_sideshow",
|
6
|
+
title: "Introducing Sideshow",
|
7
|
+
description: "Introducing the main features and concepts of Sideshow. ",
|
8
|
+
estimatedTime: "10 Minutes",
|
9
|
+
affects: [
|
10
|
+
function(){
|
11
|
+
//Here we could do any checking to infer if this tutorial is eligible the current screen/context.
|
12
|
+
//After this checking, just return a boolean indicating if this tutorial will be available.
|
13
|
+
//As a simple example we're returning a true, so this tutorial would be available in any context
|
14
|
+
return true;
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}).storyLine({
|
18
|
+
showStepPosition: true,
|
19
|
+
steps: [
|
20
|
+
{
|
21
|
+
title: "More than a tour... we can do much more.",
|
22
|
+
text: "Sideshow can much more than just walk users through your site/web application. Sideshow can mediate the interaction between users and your UI. Go ahead and let's see some powerful features."
|
23
|
+
},
|
24
|
+
{
|
25
|
+
title: "The Subject",
|
26
|
+
text: "In each step of a tutorial/wizard/tour/help (you can call it the way you want =D ) you're talking about something. Sometimes you're just explaining a concept, but at the most part of time, you're explaining some visual part of a screen or a page (e.g. a form, button, div, grid and so forth). We call these visual parts subjects. A subject of a step is just an element of your page you're aiming to stand out from the rest (when user is seeing that especific step) to comment/explain something about it."
|
27
|
+
},
|
28
|
+
{
|
29
|
+
title: "The Subject",
|
30
|
+
text: "In each step of a tutorial/wizard/tour/help (you can call it the way you want =D ) you're talking about something. Sometimes you're just explaining a concept, but at the most part of time, you're explaining some visual part of a screen or a page (e.g. a form, button, div, grid and so forth). We call these visual parts subjects. A subject of a step is just an element of your page you're aiming to stand out from the rest (when user is seeing that especific step) to comment/explain something about it.",
|
31
|
+
skipIf: function(){
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
title: "Masking a Subject",
|
37
|
+
text: "An example could be this text: in this step, this text is the subject. As you can see, we're surrounding it with a dark mask. This make you look at the subject with no doubt where it's located. If you're curious how we make it work: for the moment, you just need to know we're not using `z-index` to pull the subject above the mask. Some tour libraries do this, we see a plenty of drawbacks in this approach. \n\n When writing a tutorial, each subject is represented by a jQuery-like/querySelectorAll-like/CSS-like selector. For this step, for instance, the subject is a `div`, and its selector is `#introducing_sideshow`, but could be any other valid selector returning the same element.\n\nP.S: for now, Sideshow only supports single subjects per step. If you define a subject selector which returns more than one element, Sideshow will throw an exception. Multiple steps will (propably) be available in future versions of Sideshow.",
|
38
|
+
subject: "#introducing_sideshow",
|
39
|
+
format: "markdown"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
title: "You Won't lose your Rounded Corners",
|
43
|
+
text: "We would never leave you without your rounded corners! =)\n\nJust see this button again, look at the corners, they're pretty masked pal!\n\nP.S: Don't blame me if the button click is not doing anything. This behavior is correct, you can't open two instances of Sideshow simultaneously. ;-)",
|
44
|
+
subject: "#run_example",
|
45
|
+
format: "markdown"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
title: "Preventing Undesirable Clicks",
|
49
|
+
text: "In the previous step, probably you tried to click on that button. The user shouln't be able to click in the button in that moment. Sideshow can deal with this situation easily, there's a step option `lockSubject` which preserves the mask appearance but prevents the user to interact with the subject with the mouse.\n\n**Just try to click in the button.**",
|
50
|
+
subject: "#run_example",
|
51
|
+
lockSubject: true,
|
52
|
+
format: "markdown"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
title: "Targets - Pointing to items in the subject area",
|
56
|
+
text: "As we've seen previously, by masking a subject, we highlight a specific zone of a page which we want to explain.\n\nAlthough this is enough for a great deal of cases, sometimes we need to \"point\" to one or more itens inside the subject area. Sideshow can do this easily for you, as easy as you define subjects. Let's see an example in the next step.",
|
57
|
+
format: "markdown"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
title: "Targets - A simple example",
|
61
|
+
text: "To point to the last `em` tag of this description, just declare a step option called `targets` setting its value with a selector for this tag. >>> `targets: \"#introducing_sideshow em:last-of-type\"`.\n\nAs you can see, it's just a CSS selector, no complications here!",
|
62
|
+
subject: "#introducing_sideshow",
|
63
|
+
targets: "#introducing_sideshow em:last-of-type",
|
64
|
+
format: "markdown"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
title: "Targets - Multiple targets",
|
68
|
+
text: "Here you can see an example of multiple targets. The selector used for these targets is `#survey input`.",
|
69
|
+
subject: "#survey",
|
70
|
+
targets: "#survey input",
|
71
|
+
format: "markdown"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
title: "Targets - Multiple targets",
|
75
|
+
text: "Another example of multiple targets. The selector used for these targets is `#introducing_sideshow em:last-of-type, #header_content > img`.",
|
76
|
+
subject: "header",
|
77
|
+
targets: "#introducing_sideshow em:last-of-type, #header_content > img",
|
78
|
+
format: "markdown"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
title: "We can scroll too!",
|
82
|
+
text: "When a subject isn't fully visible, Sideshow automatically scrolls the page 'til the subject is squared.",
|
83
|
+
subject: "#godfather1"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
title: "We're back to the top!",
|
87
|
+
text: "Well, we're on top again. Now, let's learn an important concept of Sideshow, the step completing conditions.",
|
88
|
+
subject: "#header_content > img"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
title: "Step Completing Conditions",
|
92
|
+
text: function(){/*
|
93
|
+
There are some cases where you just don't want the user to be able to continue the tutorial by clicking in the next button.
|
94
|
+
|
95
|
+
* You want the user to perform some action, or...
|
96
|
+
* You're waiting for a server response, or...
|
97
|
+
* You're expecting your application to be in some specific state before allowing user to continue.
|
98
|
+
|
99
|
+
Sideshow provides a way for detecting if your tutorial is ready to proceed to the next step. This feature is called **completing conditions**, you just need to define a function (an evaluator), which will perform some checking and return a boolean. This function is evaluated continuously and shouldn't change the state of your application. When this function return a true value, the user will be allowed to continue.
|
100
|
+
*/},//<<This block-comment-inside-function syntax is a trick to allow some sort of HEREDOC syntax, this can't be used in minified tutorial files, these comments are simply stripped out.
|
101
|
+
format: "markdown"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
title: "An Example of Completing Condition",
|
105
|
+
text: "Ok, look at the Next button, it's disabled, for now you're not allowed to continue. As an example, the **completing condition** for this step is that user (obviously you =D) has to drag the Dr. Brown photo and drop it over the red square. Please, perform this action in order to activate the next button.",
|
106
|
+
format: "markdown",
|
107
|
+
listeners: {
|
108
|
+
beforeStep: function(){
|
109
|
+
$("#red_square").fadeIn(function(){
|
110
|
+
$('#red_square').on('dragover', function (e) {
|
111
|
+
var event = e.originalEvent;
|
112
|
+
if (event.preventDefault) {
|
113
|
+
event.preventDefault();
|
114
|
+
}
|
115
|
+
event.dataTransfer.dropEffect = 'copy';
|
116
|
+
return false;
|
117
|
+
});
|
118
|
+
|
119
|
+
$('#red_square').on('drop', function (e) {
|
120
|
+
var event = e.originalEvent;
|
121
|
+
if (event.stopPropagation) {
|
122
|
+
event.stopPropagation();
|
123
|
+
}
|
124
|
+
$('#dr_brown').appendTo(this);
|
125
|
+
|
126
|
+
//Let's hide the target arrows (in future versions of Sideshow we'll have a more elegant way to do this inside a listener =D)
|
127
|
+
$(".sideshow-subject-arrow").fadeOut();
|
128
|
+
|
129
|
+
return false;
|
130
|
+
});
|
131
|
+
|
132
|
+
});
|
133
|
+
|
134
|
+
}
|
135
|
+
},
|
136
|
+
targets: "#dr_brown, #red_square",
|
137
|
+
subject: "#bttf",
|
138
|
+
autoContinue: false,
|
139
|
+
completingConditions: [
|
140
|
+
function(){
|
141
|
+
return $("#red_square #dr_brown").length > 0;
|
142
|
+
}
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
title: "Auto Continue",
|
147
|
+
text: "If you want Sideshow proceed automatically to the next step, you can use set **autoContinue** flag to true. This way, when your completing conditions are satisfied, Sideshow will continue to the next step.\n\nDrag the Dr. Brown photo again to its original place to continue.",
|
148
|
+
format: "markdown",
|
149
|
+
listeners: {
|
150
|
+
beforeStep: function(){
|
151
|
+
$('#bttf figure').on('dragover', function (e) {
|
152
|
+
var event = e.originalEvent;
|
153
|
+
if (event.preventDefault) {
|
154
|
+
event.preventDefault();
|
155
|
+
}
|
156
|
+
event.dataTransfer.dropEffect = 'copy';
|
157
|
+
return false;
|
158
|
+
});
|
159
|
+
|
160
|
+
$('#bttf figure').on('drop', function (e) {
|
161
|
+
var event = e.originalEvent;
|
162
|
+
if (event.stopPropagation) {
|
163
|
+
event.stopPropagation();
|
164
|
+
}
|
165
|
+
$('#dr_brown').appendTo(this);
|
166
|
+
|
167
|
+
//Let's hide the target arrows (in future versions of Sideshow we'll have a more elegant way to do this inside a listener =D)
|
168
|
+
$(".sideshow-subject-arrow").fadeOut();
|
169
|
+
|
170
|
+
return false;
|
171
|
+
});
|
172
|
+
},
|
173
|
+
afterStep: function(){
|
174
|
+
$("#red_square").fadeOut();
|
175
|
+
}
|
176
|
+
},
|
177
|
+
targets: "#bttf figure, #dr_brown",
|
178
|
+
subject: "#bttf",
|
179
|
+
autoContinue: true,
|
180
|
+
completingConditions: [
|
181
|
+
function(){
|
182
|
+
return $("#bttf figure #dr_brown").length > 0;
|
183
|
+
}
|
184
|
+
]
|
185
|
+
},
|
186
|
+
{
|
187
|
+
title: "Rich Formatting with Markdown",
|
188
|
+
text: function(){/*
|
189
|
+
Most of times you we'll need just plain text for your step descriptions, but you may also need to add some kind of formatting. For this purpose, Sideshow accepts Markdown text. You just need to set the `format` step property to `"markdown"`.
|
190
|
+
This way you could use:
|
191
|
+
|
192
|
+
* Unordered lists
|
193
|
+
* Like this one.
|
194
|
+
* Or maybe...
|
195
|
+
|
196
|
+
----------------------
|
197
|
+
|
198
|
+
1. This is
|
199
|
+
2. An ordered list
|
200
|
+
3. It's simple to use
|
201
|
+
|
202
|
+
**A bold text**
|
203
|
+
|
204
|
+
*An italic text*
|
205
|
+
|
206
|
+
`Source code example`
|
207
|
+
|
208
|
+

|
209
|
+
*/},
|
210
|
+
format: "markdown"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
title: "Events",
|
214
|
+
text: "You can listen to events like `beforeStep`, `afterStep`, `beforeWizardStarts`, `afterWizardEnds` and do whatever you want. Like preparing the environment for the next step.",
|
215
|
+
format: "markdown"
|
216
|
+
},
|
217
|
+
{
|
218
|
+
title: "Moving to other step",
|
219
|
+
text: "You can move to other step by its position (which is 1-based) or by its name property, which is an unique identifier. Simply call `Sideshow.gotoStep(3)` or `Sideshow.gotoStep(\"creating_users\")`. \n\n--------\nIt's also possible to skip a step if some condition is true: \n\nwith the step property `skiIf` you can set an evaluator which is called in the entrance of the step, and if this evaluator function return true, the step is automatically skipped.",
|
220
|
+
format: "markdown"
|
221
|
+
},
|
222
|
+
{
|
223
|
+
title: "Related Tutorials",
|
224
|
+
text: "You can also define relationships between tutorials, this way, after finishing a tutorial, the user sees a list of others related to this.",
|
225
|
+
format: "markdown"
|
226
|
+
},
|
227
|
+
{
|
228
|
+
title: "Tutorial Eligibility Conditions",
|
229
|
+
text: function(){/*
|
230
|
+
It's possible to define if a tutorial is eligible for a specific context (a screen, URL, some specific application state, or any other thing which can be tested programmatically). If your tutorials are registered and imported globally, for your whole application, you can create rules for each one (if it will be listed in the Sideshow menu).
|
231
|
+
|
232
|
+
For example, you may want to do something like this:
|
233
|
+
|
234
|
+
<pre>
|
235
|
+
<code>
|
236
|
+
affects: [
|
237
|
+
{ hash: "#/messages" },
|
238
|
+
{ route: "/adm/orders", caseSensitive: true },
|
239
|
+
function(){
|
240
|
+
return $(".grid").length > 0;
|
241
|
+
}
|
242
|
+
]
|
243
|
+
</code>
|
244
|
+
</pre>
|
245
|
+
|
246
|
+
In the code above, we're making some fictional tutorial available in three differente situations:
|
247
|
+
|
248
|
+
* When the URL hash is "#/messages"
|
249
|
+
* When the route is "/adm/orders". Note we're setting a caseSensitive flag to true (this is useful, for instance, for *nix based web servers), so this tutorial will not be listed in a route "#/ADM/routes".
|
250
|
+
* We've added a custom evaluator which just checks if there's some grid (or any element with a `grid` class attribute) in the page, if so, the tutorial is eligible for the current page.
|
251
|
+
*/},
|
252
|
+
format: "markdown"
|
253
|
+
},
|
254
|
+
{
|
255
|
+
title: "That's (NOT) all, folks!",
|
256
|
+
text: "There's a wide variety of interesting features in this version of Sideshow, some of which we didn't mention in this introductory tutorial. Take this sample, the documentation, open your favorite editor for Javascript and play at will!"
|
257
|
+
}
|
258
|
+
]
|
259
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
*{font-family:OpenSans Light}header{width:100%;height:350px;padding-top:20px;background-color:#e4e4e4}body{padding-bottom:40px}#header_content{height:100%}#introducing_sideshow{position:absolute;z-index:10;right:0;top:80px;width:330px;text-align:right;color:#802000}#introducing_sideshow em{color:#fff;font-style:normal;background-color:#c30;line-height:25px}header img{position:absolute;top:20px}.main-content{position:relative;width:920px;margin:auto}#run_example{border-radius:4px;-webkit-transition:background-color 300ms ease,border-bottom-width 100ms ease;transition:background-color 300ms ease,border-bottom-width 100ms ease;border:1px solid #181818;border-bottom-width:5px;font-size:26px;padding:10px 15px 10px 20px;background-color:#802000;color:#fff;position:absolute;left:0;bottom:50px}#run_example:before{font-family:sideshow-icons;font-style:normal;font-weight:400;speak:none;display:inline-block;text-decoration:inherit;width:1em;text-align:center;font-variant:normal;text-transform:none;content:'\e800';margin-right:10px;font-size:26px}#run_example:after{content:'';display:inline-block;width:5px}#run_example:hover{background-color:#c30}#run_example:hover:after{content:"!"}#run_example:active{background-color:#777;border-bottom-width:1px;outline-width:0}.forkme{position:absolute;top:0;right:0;border:0;z-index:9}.browsehappy{background-color:#700;color:#fff;display:block;margin:0;line-height:50px;padding-left:30px;height:50px}.browsehappy a{color:#fff}.browsehappy:before{margin-right:5px}#wrapper{padding-top:20px}#wrapper h1,#wrapper h2,#wrapper h3{font-family:OpenSans Semibold;font-weight:400}#wrapper h1{font-size:22px;text-transform:uppercase}footer{position:fixed;bottom:0;left:0;right:0;padding-right:10px;height:30px;background-color:rgba(255,255,255,.8);font-size:12px;text-align:right}footer a{font-family:OpenSans Semibold;color:#333;text-decoration:none}#bttf{width:500px;display:inline-block}#bttf figure{height:195px;width:195px;float:left;margin:0 10px 0 0}#dr_brown{width:195px}#red_square{border-radius:4px;position:absolute;left:230px;top:50px;background-color:rgba(119,0,0,.7);width:195px;height:195px;padding:25px;display:none}#survey{display:inline-block;vertical-align:top;margin-left:50px}#survey #first_name,#survey #last_name{width:220px}#survey #email{width:280px}#godfather1 img{float:left;width:280px;margin-right:10px;margin-bottom:10px}#godfather1 .columns-text{display:block;-webkit-columns:3;-moz-columns:3;columns:3;-webkit-column-width:120px;-moz-column-width:120px;column-width:120px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-webkit-column-count:3;-moz-column-count:3;column-count:3}#godfather1 .columns-text p:first-of-type{margin-top:0}#godfather1 .columns-text p:first-of-type:first-letter{font-size:65px;font-family:georgia;float:left;line-height:60px}#wrapper input[type=text]{border-radius:3px;border:1px solid #b1b1b1;padding:5px}#wrapper button{border-radius:3px;font-family:OpenSans Semibold;border:1px solid #802000;padding:5px;margin:0;background-color:#ff4000;color:#fff}#wrapper hr{border-width:0;border-top:double 4px #b1b1b1;width:60%;margin-top:30px;margin-bottom:30px}fieldset{padding:0;border:0}fieldset label{display:block;margin-bottom:5px}fieldset ul{padding:0}fieldset>ul>li{list-style-type:none;margin-bottom:15px}
|
@@ -0,0 +1,272 @@
|
|
1
|
+
@import '../../../stylesheets/_icons';
|
2
|
+
|
3
|
+
//Variables
|
4
|
+
sideshow-example-base-color = #E4E4E4;
|
5
|
+
sideshow-example-base-color-dark = darken(sideshow-example-base-color, 20);
|
6
|
+
sideshow-example-base-color-darkest = darken(sideshow-example-base-color, 40);
|
7
|
+
sideshow-example-secondary-color = #C30;
|
8
|
+
sideshow-example-secondary-color-dark = darken(sideshow-example-secondary-color, 15);
|
9
|
+
sideshow-example-secondary-color-lighter = lighten(sideshow-example-secondary-color, 10);
|
10
|
+
|
11
|
+
//Layout rules
|
12
|
+
*{
|
13
|
+
font-family: OpenSans Light;
|
14
|
+
}
|
15
|
+
|
16
|
+
header{
|
17
|
+
width: 100%;
|
18
|
+
height: 350px;
|
19
|
+
padding-top: 20px;
|
20
|
+
background-color: sideshow-example-base-color;
|
21
|
+
}
|
22
|
+
|
23
|
+
body{
|
24
|
+
padding-bottom: 40px;
|
25
|
+
}
|
26
|
+
|
27
|
+
#header_content{
|
28
|
+
height: 100%;
|
29
|
+
}
|
30
|
+
|
31
|
+
#introducing_sideshow{
|
32
|
+
position: absolute;
|
33
|
+
z-index: 10;
|
34
|
+
right: 0;
|
35
|
+
top: 80px;
|
36
|
+
width: 330px;
|
37
|
+
text-align: right;
|
38
|
+
color: sideshow-example-secondary-color-dark;
|
39
|
+
}
|
40
|
+
|
41
|
+
#introducing_sideshow em{
|
42
|
+
color: #FFF;
|
43
|
+
font-style: normal;
|
44
|
+
background-color: sideshow-example-secondary-color;
|
45
|
+
line-height: 25px;
|
46
|
+
}
|
47
|
+
|
48
|
+
header img{
|
49
|
+
position: absolute;
|
50
|
+
top: 20px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.main-content{
|
54
|
+
position: relative;
|
55
|
+
width: 920px;
|
56
|
+
margin: auto;
|
57
|
+
}
|
58
|
+
|
59
|
+
#run_example{
|
60
|
+
border-radius: 4px;
|
61
|
+
transition: background-color 300ms ease, border-bottom-width 100ms ease;
|
62
|
+
icon-play();
|
63
|
+
|
64
|
+
border: solid 1px darken(sideshow-example-base-color, 80);
|
65
|
+
border-bottom-width: 5px;
|
66
|
+
font-size: 26px;
|
67
|
+
padding: 10px;
|
68
|
+
padding-right: 15px;
|
69
|
+
padding-left: 20px;
|
70
|
+
background-color: sideshow-example-secondary-color-dark;
|
71
|
+
color: #FFF;
|
72
|
+
position: absolute;
|
73
|
+
left: 0;
|
74
|
+
bottom: 50px;
|
75
|
+
|
76
|
+
&:before{
|
77
|
+
margin-right: 10px;
|
78
|
+
font-size: 26px;
|
79
|
+
}
|
80
|
+
|
81
|
+
&:after{
|
82
|
+
content: '';
|
83
|
+
display: inline-block;
|
84
|
+
width: 5px;
|
85
|
+
}
|
86
|
+
|
87
|
+
&:hover{
|
88
|
+
background-color: sideshow-example-secondary-color;
|
89
|
+
&:after{
|
90
|
+
content: "!";
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
&:active{
|
95
|
+
background-color: #777;
|
96
|
+
border-bottom-width: 1px;
|
97
|
+
outline-width: 0;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
.forkme{
|
102
|
+
position: absolute;
|
103
|
+
top: 0;
|
104
|
+
right: 0;
|
105
|
+
border: 0;
|
106
|
+
z-index: 9;
|
107
|
+
}
|
108
|
+
|
109
|
+
.browsehappy{
|
110
|
+
icon-exclamation-triangle();
|
111
|
+
background-color: #700;
|
112
|
+
color: #FFF;
|
113
|
+
display: block;
|
114
|
+
margin: 0;
|
115
|
+
line-height: 50px;
|
116
|
+
padding-left: 30px;
|
117
|
+
height: 50px;
|
118
|
+
a{
|
119
|
+
color: #FFF;
|
120
|
+
}
|
121
|
+
&:before{
|
122
|
+
margin-right: 5px;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
#wrapper{
|
127
|
+
padding-top: 20px;
|
128
|
+
h1, h2, h3{
|
129
|
+
font-family: OpenSans Semibold;
|
130
|
+
font-weight: normal;
|
131
|
+
}
|
132
|
+
|
133
|
+
h1{
|
134
|
+
font-size: 22px;
|
135
|
+
text-transform: uppercase;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
footer{
|
140
|
+
position: fixed;
|
141
|
+
bottom: 0;
|
142
|
+
left: 0;
|
143
|
+
right: 0;
|
144
|
+
padding-right: 10px;
|
145
|
+
height: 30px;
|
146
|
+
background-color: rgba(#FFF, 0.8);
|
147
|
+
font-size: 12px;
|
148
|
+
text-align: right;
|
149
|
+
a{
|
150
|
+
font-family: OpenSans Semibold;
|
151
|
+
color: #333;
|
152
|
+
text-decoration: none;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
/*Fake content*/
|
157
|
+
|
158
|
+
#bttf{
|
159
|
+
width: 500px;
|
160
|
+
display: inline-block;
|
161
|
+
figure{
|
162
|
+
height: 195px;
|
163
|
+
width: 195px;
|
164
|
+
float: left;
|
165
|
+
margin: 0;
|
166
|
+
margin-right: 10px;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
#dr_brown{
|
171
|
+
width: 195px;
|
172
|
+
}
|
173
|
+
|
174
|
+
#red_square{
|
175
|
+
border-radius: 4px;
|
176
|
+
position: absolute;
|
177
|
+
left: 230px;
|
178
|
+
top: 50px;
|
179
|
+
background-color: rgba(#700, 0.7);
|
180
|
+
width: 195px;
|
181
|
+
height: 195px;
|
182
|
+
padding: 25px;
|
183
|
+
display: none;
|
184
|
+
}
|
185
|
+
|
186
|
+
#survey{
|
187
|
+
display: inline-block;
|
188
|
+
vertical-align: top;
|
189
|
+
margin-left: 50px;
|
190
|
+
#first_name{
|
191
|
+
width: 220px;
|
192
|
+
}
|
193
|
+
|
194
|
+
#last_name{
|
195
|
+
width: 220px;
|
196
|
+
}
|
197
|
+
|
198
|
+
#email{
|
199
|
+
width: 280px;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
#godfather1{
|
204
|
+
img{
|
205
|
+
float: left;
|
206
|
+
width: 280px;
|
207
|
+
margin-right: 10px;
|
208
|
+
margin-bottom: 10px;
|
209
|
+
}
|
210
|
+
|
211
|
+
.columns-text{
|
212
|
+
display: block;
|
213
|
+
columns: 3;
|
214
|
+
column-width: 120px;
|
215
|
+
column-gap: 15px;
|
216
|
+
column-count: 3;
|
217
|
+
p:first-of-type{
|
218
|
+
&:first-letter{
|
219
|
+
font-size: 65px;
|
220
|
+
font-family: georgia;
|
221
|
+
float: left;
|
222
|
+
line-height: 60px;
|
223
|
+
}
|
224
|
+
margin-top: 0;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
#wrapper{
|
230
|
+
input[type=text]{
|
231
|
+
border-radius: 3px;
|
232
|
+
border: solid 1px sideshow-example-base-color-dark;
|
233
|
+
padding: 5px;
|
234
|
+
}
|
235
|
+
|
236
|
+
button{
|
237
|
+
border-radius: 3px;
|
238
|
+
font-family: OpenSans Semibold;
|
239
|
+
border: solid 1px sideshow-example-secondary-color-dark;
|
240
|
+
padding: 5px;
|
241
|
+
margin: 0;
|
242
|
+
background-color: sideshow-example-secondary-color-lighter;
|
243
|
+
color: #FFF;
|
244
|
+
}
|
245
|
+
|
246
|
+
hr{
|
247
|
+
border-width: 0;
|
248
|
+
border-top: double 4px sideshow-example-base-color-dark;
|
249
|
+
width: 60%;
|
250
|
+
margin-top: 30px;
|
251
|
+
margin-bottom: 30px;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
fieldset {
|
256
|
+
padding: 0;
|
257
|
+
border: 0;
|
258
|
+
|
259
|
+
label{
|
260
|
+
display: block;
|
261
|
+
margin-bottom: 5px;
|
262
|
+
}
|
263
|
+
|
264
|
+
ul{
|
265
|
+
padding: 0;
|
266
|
+
}
|
267
|
+
|
268
|
+
> ul > li{
|
269
|
+
list-style-type: none;
|
270
|
+
margin-bottom: 15px;
|
271
|
+
}
|
272
|
+
}
|
data/gulp/config.js
ADDED
File without changes
|
@@ -0,0 +1,151 @@
|
|
1
|
+
/* Created by FrankFang on 14-7-24. */
|
2
|
+
/* jshint -W040:true */
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
var fs = require('fs')
|
6
|
+
var path = require('path')
|
7
|
+
var through2 = require('through2')
|
8
|
+
var gUtil = require('gulp-util')
|
9
|
+
var PluginError = gUtil.PluginError
|
10
|
+
|
11
|
+
module.exports = function (options) {
|
12
|
+
|
13
|
+
options = options || {}
|
14
|
+
|
15
|
+
return through2.obj(function (file, enc, cb) {
|
16
|
+
|
17
|
+
if (file.isNull()) {
|
18
|
+
return cb(null, file)
|
19
|
+
}
|
20
|
+
|
21
|
+
if (file.isStream()) {
|
22
|
+
return cb(new PluginError('gulp-html-extend', 'Streaming is not supported'))
|
23
|
+
}
|
24
|
+
|
25
|
+
if (file.isBuffer()) {
|
26
|
+
|
27
|
+
extendFile(file, function (noMaster) {
|
28
|
+
return cb(null, file)
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
})
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
function makeFile(absolutePath, cb) {
|
38
|
+
fs.readFile(absolutePath, function (error, data) {
|
39
|
+
if (error) { throw error }
|
40
|
+
var file = new gUtil.File({
|
41
|
+
base: path.dirname(absolutePath),
|
42
|
+
path: absolutePath,
|
43
|
+
contents: new Buffer(data),
|
44
|
+
})
|
45
|
+
cb(file)
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
function extendFile(file, afterExtend) {
|
50
|
+
|
51
|
+
var fileContent = file.contents.toString()
|
52
|
+
var fileLines = splitByLine(fileContent)
|
53
|
+
|
54
|
+
var includedLines = fileLines.map(function (line) {
|
55
|
+
var includeRelativePath = findInclude(line)
|
56
|
+
if (includeRelativePath) {
|
57
|
+
var includeAbsolutePath = path.join(path.dirname(file.path), includeRelativePath)
|
58
|
+
return fs.readFileSync(includeAbsolutePath);
|
59
|
+
} else {
|
60
|
+
return line
|
61
|
+
}
|
62
|
+
})
|
63
|
+
|
64
|
+
file.contents = new Buffer(includedLines.join('\n'))
|
65
|
+
|
66
|
+
|
67
|
+
var masterRelativePath = findMaster(file.contents.toString('utf-8'))
|
68
|
+
if (!masterRelativePath) {
|
69
|
+
afterExtend()
|
70
|
+
return
|
71
|
+
}
|
72
|
+
|
73
|
+
var masterAbsolute = path.join(path.dirname(file.path), masterRelativePath)
|
74
|
+
|
75
|
+
makeFile(masterAbsolute, function (masterFile) {
|
76
|
+
|
77
|
+
extendFile(masterFile, function () {
|
78
|
+
|
79
|
+
var masterContent = masterFile.contents.toString()
|
80
|
+
var lines = masterContent.split(/\n|\r|\r\n/)
|
81
|
+
|
82
|
+
var newLines = lines.map(function (line, index, array) {
|
83
|
+
var blockName = findPlaceholder(line)
|
84
|
+
if (blockName) {
|
85
|
+
var blockContent = getBlockContent(file.contents.toString(), blockName)
|
86
|
+
return blockContent || line
|
87
|
+
} else {
|
88
|
+
return line
|
89
|
+
}
|
90
|
+
})
|
91
|
+
|
92
|
+
var newContent = newLines.join('\n')
|
93
|
+
|
94
|
+
file.contents = new Buffer(newContent)
|
95
|
+
|
96
|
+
return afterExtend()
|
97
|
+
|
98
|
+
})
|
99
|
+
|
100
|
+
})
|
101
|
+
|
102
|
+
}
|
103
|
+
|
104
|
+
function findMaster(string) {
|
105
|
+
var regex = /<!--\s*@@master\s*=\s*(\S+)\s*-->/
|
106
|
+
var match = string.match(regex)
|
107
|
+
return match ? match[1] : null
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
function findInclude(string) {
|
112
|
+
var regex = /<!--\s*@@include\s*=\s*(\S+)\s*-->/
|
113
|
+
var match = string.match(regex)
|
114
|
+
return match ? match[1] : null
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
function findPlaceholder(string) {
|
119
|
+
var regex = /<!--\s*@@placeholder\s*=\s*(\S+)\s*-->/
|
120
|
+
var match = string.match(regex)
|
121
|
+
return match ? match[1] : null
|
122
|
+
}
|
123
|
+
|
124
|
+
function getBlockContent(string, blockName) {
|
125
|
+
var result = ''
|
126
|
+
var lines = splitByLine(string)
|
127
|
+
var inBlock = false
|
128
|
+
var regex = new RegExp('<!--\\s*@@block\\s*=\\s*' + blockName + '\\s*-->')
|
129
|
+
|
130
|
+
return lines.reduce(function (prev, current) {
|
131
|
+
if (inBlock) {
|
132
|
+
var matchEnd = /<!--\s*@@close\s*-->/.test(current)
|
133
|
+
if (matchEnd) {
|
134
|
+
inBlock = false
|
135
|
+
return prev
|
136
|
+
}
|
137
|
+
return prev + (prev === '' ? '' : '\n') + current
|
138
|
+
}
|
139
|
+
var matchBegin = regex.test(current)
|
140
|
+
if (matchBegin) {
|
141
|
+
inBlock = true
|
142
|
+
return prev
|
143
|
+
} else {
|
144
|
+
return prev
|
145
|
+
}
|
146
|
+
}, '');
|
147
|
+
}
|
148
|
+
|
149
|
+
function splitByLine(string) {
|
150
|
+
return string.split(/\n|\r|\r\n/)
|
151
|
+
}
|
data/gulp/tasks/.gitkeep
ADDED
File without changes
|
data/icons/iconfont.zip
ADDED
Binary file
|