-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathuser-guide.js
More file actions
104 lines (94 loc) · 3.33 KB
/
Copy pathuser-guide.js
File metadata and controls
104 lines (94 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
(function() {
"use strict";
function viewedAlready() {
if (window.location.hash === '#view-intro') {
return false;
}
try {
return window.localStorage.getItem('user-guide') === 'viewed';
} catch (e) {
//sometimes localStorage is blocked by security settings. try cookies
return document.cookie.indexOf('userguide=viewed') >= 0;
}
}
function setViewed() {
try {
window.localStorage.setItem('user-guide', 'viewed');
} catch (e) {
document.cookie = "userguide=viewed;max-age=31536000;path=/";
}
if (window.location.hash === '#view-intro') {
window.location.hash = '';
}
}
function setup(force) {
if (viewedAlready() && force !== true) {
return Promise.reject();
}
if ('introJs' in window) {
return Promise.resolve();
}
return Promise.all([
new Promise(function(r1) {
var link = document.createElement('link');
link.rel = "stylesheet";
link.href = "/intro.js/introjs.css";
link.addEventListener('load', r1);
document.head.insertBefore(link, document.getElementById('typetools-main-css'))
}),
new Promise(function(r2) {
var link = document.createElement('link');
link.rel = "stylesheet";
link.href = "/user-guide.css";
link.addEventListener('load', r2);
document.head.insertBefore(link, document.getElementById('typetools-main-css'))
}),
new Promise(function(r3) {
var script = document.createElement('script');
script.src="/intro.js/intro.js";
script.addEventListener('load', r3);
document.head.appendChild(script);
})
]);
}
function viewHints(force) {
setup(force).then(function() {
var intro = introJs();
intro.setOptions({
'tooltipPosition': 'right',
'steps': [
{
'intro': "Welcome to Type Tools! This is a playground for experimenting with <a href='https://variablefonts.typenetwork.com/'>OpenType variable fonts</a> in a variety of ways."
}, {
'element': document.getElementById('select-layout-container'),
'intro': "Pick a page layout! Each layout allows you to examine different aspects of the variable font design space."
}, {
'element': document.getElementById('select-font-container'),
'intro': "Choose from a selection of Type Network-affiliated fonts, or drag-and-drop your own TTF, OTF, or WOFF file onto the window to load your own variable font."
}, {
'element': document.getElementById('typography-container'),
'intro': "Standard typographic controls include size, leading, alignment and color. Font sizes are measured in CSS points."
}, {
'element': document.getElementById('axis-inputs'),
'intro': "Sliders for variable font axes will appear here. Click the “View All Axes” checkbox to show extra design dimensions beyond the standard weight/width/slant/italic/optical-size space."
}, {
'element': document.getElementById('show-stuff-container'),
'intro': "Options to show various output information about the currently configured axes."
/*
}, {
'element': document.getElementById('meta-stuff-container'),
'intro': "Options to show various output information about the currently configured axes."
*/
}]
});
intro.start();
setViewed();
}).catch(function() {
//already viewed
});
}
window.typetoolsViewIntroHints = function() {
viewHints(true);
}
$(document).on('typetools:fontChange', viewHints);
})();