-
Notifications
You must be signed in to change notification settings - Fork 24
/
startupapi.js
75 lines (59 loc) · 1.81 KB
/
startupapi.js
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
/**
* Define global namespace if it's not set yet
*/
window.STARTUPAPI = window.STARTUPAPI || {};
/*
* gets an array of messages and if one of them was passed, then displays it
*/
STARTUPAPI.showMessages = function(pagemessages) {
if (document.location.hash.substring(0, 9) == '#message=')
{
var msg = document.location.hash.substring(9);
for (var key in pagemessages)
{
if (pagemessages.hasOwnProperty(key) && msg == key)
{
var container = $('#startupapi-message');
var alert_box = $('#startupapi-message .alert');
$('#startupapi-message_copy').html(pagemessages[key]['text']);
container.show();
alert_box.slideDown('fast').addClass('alert-' + pagemessages[key]['class']);
alert_box.hover(function() {
STARTUPAPI.keepMessageOpen = true;
}, function() {
STARTUPAPI.keepMessageOpen = false;
setTimeout(STARTUPAPI.hideMessages, 1000);
});
setTimeout(STARTUPAPI.hideMessages, 2500);
document.location.hash = '#';
return;
}
}
}
}
STARTUPAPI.hideMessages = function() {
if (STARTUPAPI.keepMessageOpen) {
return;
}
$('#startupapi-message').slideUp('fast');
};
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
// See the Getting Started docs for more information:
// http://getbootstrap.com/getting-started/#support-ie10-width
(function () {
'use strict';
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style')
msViewportStyle.appendChild(
document.createTextNode(
'@-ms-viewport{width:auto!important}'
)
)
document.querySelector('head').appendChild(msViewportStyle)
}
})();