Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit d8e22a0

Browse files
Fix svg backgrounds on IE and Edge
1 parent 620c258 commit d8e22a0

File tree

5 files changed

+378
-1
lines changed

5 files changed

+378
-1
lines changed

build/stylelint.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
'!src/sass/external/**/*.scss',
99
'!src/sass/_constants.scss',
1010
'!src/sass/mixin.scss',
11+
'!src/sass/functions.scss',
1112
'!src/sass/reset.scss'
1213
]
1314
}

src/javascript/binary_pack.js

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId])
10+
/******/ return installedModules[moduleId].exports;
11+
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ exports: {},
15+
/******/ id: moduleId,
16+
/******/ loaded: false
17+
/******/ };
18+
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
22+
/******/ // Flag the module as loaded
23+
/******/ module.loaded = true;
24+
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
29+
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
36+
/******/ // __webpack_public_path__
37+
/******/ __webpack_require__.p = "";
38+
39+
/******/ // Load entry module and return exports
40+
/******/ return __webpack_require__(0);
41+
/******/ })
42+
/************************************************************************/
43+
/******/ ([
44+
/* 0 */
45+
/***/ function(module, exports, __webpack_require__) {
46+
47+
var config = __webpack_require__(1);
48+
var pjax = __webpack_require__(2);
49+
50+
__webpack_require__(3);
51+
52+
// TODO: to be remove after webpack finalized
53+
var exportAllFunctions = function exportAllFunctions(obj) {
54+
for ( var key in obj ) {
55+
if ( obj.hasOwnProperty(key) ) {
56+
window[key] = obj[key];
57+
}
58+
}
59+
};
60+
61+
exportAllFunctions(config);
62+
exportAllFunctions(pjax);
63+
64+
65+
/***/ },
66+
/* 1 */
67+
/***/ function(module, exports) {
68+
69+
/*
70+
* Configuration values needed in js codes
71+
*
72+
* NOTE:
73+
* Please use the following command to avoid accidentally committing personal changes
74+
* git update-index --assume-unchanged src/javascript/config.js
75+
*
76+
*/
77+
78+
function getAppId() {
79+
return localStorage.getItem('config.app_id') ? localStorage.getItem('config.app_id') :
80+
/staging\.binary\.com/i.test(window.location.hostname) ? '1098' : '1';
81+
}
82+
83+
function getSocketURL() {
84+
var server_url = localStorage.getItem('config.server_url');
85+
if(!server_url) {
86+
var loginid = Cookies.get('loginid'),
87+
isReal = loginid && !/^VRT/.test(loginid),
88+
toGreenPercent = {'real': 100, 'virtual': 0, 'logged_out': 0}, // default percentage
89+
categoryMap = ['real', 'virtual', 'logged_out'],
90+
randomPercent = Math.random() * 100,
91+
percentValues = Cookies.get('connection_setup'); // set by GTM
92+
93+
// override defaults by cookie values
94+
if(percentValues && percentValues.indexOf(',') > 0) {
95+
var cookiePercents = percentValues.split(',');
96+
categoryMap.map(function(cat, idx) {
97+
if(cookiePercents[idx] && !isNaN(cookiePercents[idx])) {
98+
toGreenPercent[cat] = +cookiePercents[idx].trim();
99+
}
100+
});
101+
}
102+
103+
server_url = (/staging\.binary\.com/i.test(window.location.hostname) ? 'www2' :
104+
(isReal ? (randomPercent < toGreenPercent.real ? 'green' : 'blue') :
105+
loginid ? (randomPercent < toGreenPercent.virtual ? 'green' : 'blue') :
106+
(randomPercent < toGreenPercent.logged_out ? 'green' : 'blue'))
107+
) + '.binaryws.com';
108+
}
109+
return 'wss://' + server_url + '/websockets/v3';
110+
}
111+
112+
module.exports = {
113+
getAppId: getAppId,
114+
getSocketURL: getSocketURL,
115+
};
116+
117+
118+
/***/ },
119+
/* 2 */
120+
/***/ function(module, exports) {
121+
122+
//For object shape coherence we create named objects to be inserted into the queue.
123+
var URLPjaxQueueElement = function(exec_function, url) {
124+
this.method = exec_function;
125+
if(url) {
126+
this.url = new RegExp(url);
127+
} else {
128+
this.url = /.*/;
129+
}
130+
};
131+
132+
URLPjaxQueueElement.prototype = {
133+
fire: function(in_url) {
134+
if(this.url.test(in_url)) {
135+
this.method();
136+
}
137+
}
138+
};
139+
140+
var IDPjaxQueueElement = function(exec_function, id) {
141+
this.method = exec_function;
142+
this.sel = '#' + id;
143+
};
144+
145+
IDPjaxQueueElement.prototype = {
146+
fire: function() {
147+
if($(this.sel).length > 0) {
148+
this.method();
149+
}
150+
}
151+
};
152+
153+
var PjaxExecQueue = function () {
154+
this.url_exec_queue = [];
155+
this.id_exec_queue = [];
156+
this.fired = false;
157+
this.content = $('#content');
158+
};
159+
160+
PjaxExecQueue.prototype = {
161+
queue: function (exec_function) {
162+
this.url_exec_queue.unshift(new URLPjaxQueueElement(exec_function));
163+
},
164+
queue_for_url: function (exec_function, url_pattern) {
165+
this.url_exec_queue.unshift(new URLPjaxQueueElement(exec_function, url_pattern));
166+
},
167+
queue_if_id_present: function(exec_function, id) {
168+
this.id_exec_queue.unshift(new IDPjaxQueueElement(exec_function, id));
169+
},
170+
fire: function () {
171+
if(!this.fired) {
172+
var match_loc = window.location.href;
173+
var i = this.url_exec_queue.length;
174+
while(i--) {
175+
this.url_exec_queue[i].fire(match_loc);
176+
}
177+
178+
i = this.id_exec_queue.length;
179+
while(i--) {
180+
this.id_exec_queue[i].fire(match_loc);
181+
}
182+
}
183+
this.fired = true;
184+
},
185+
reset: function() {
186+
this.fired = false;
187+
},
188+
loading: function () {
189+
this.reset();
190+
},
191+
count: function () {
192+
return exec_queue.length;
193+
},
194+
show: function (for_url) {
195+
for (var i=0; i < exec_queue.length; i++) {
196+
if(for_url) {
197+
if(exec_queue[i].url.test(for_url)) {
198+
console.log("" + exec_queue[i].method);
199+
}
200+
} else {
201+
console.log(exec_queue[i].url + " : " + exec_queue[i].method);
202+
}
203+
}
204+
}
205+
};
206+
207+
var pjax_config_page = function(url, exec_functions) {
208+
var functions = exec_functions();
209+
if (functions.onLoad) onLoad.queue_for_url(functions.onLoad, url);
210+
if (functions.onUnload) onUnload.queue_for_url(functions.onUnload, url);
211+
};
212+
213+
var pjax_config = function() {
214+
return {
215+
'container': 'content',
216+
'beforeSend': function() {
217+
onLoad.loading();
218+
onUnload.fire();
219+
},
220+
'complete': function() {
221+
page.is_loaded_by_pjax = true;
222+
onLoad.fire();
223+
onUnload.reset();
224+
},
225+
'error': function(event) {
226+
var error_text = SessionStore.get('errors.500');
227+
if(error_text) {
228+
$('#content').html(error_text);
229+
} else {
230+
$.get('/errors/500.html').always(function(content) {
231+
var tmp = document.createElement('div');
232+
tmp.innerHTML = content;
233+
var tmpNodes = tmp.getElementsByTagName('div');
234+
for(var i=0,l=tmpNodes.length;i<l;i++){
235+
if(tmpNodes[i].id == 'content') {
236+
SessionStore.set('errors.500', tmpNodes[i].innerHTML);
237+
$('#content').html(tmpNodes[i].innerHTML);
238+
break;
239+
}
240+
}
241+
});
242+
}
243+
244+
$('#server_clock').html('GMT Time: ' + moment(page.header.time_now).utc().format("YYYY-MM-DD HH:mm"));
245+
246+
},
247+
'useClass': 'pjaxload',
248+
};
249+
};
250+
251+
var init_pjax = function () {
252+
var document_location = document.URL;
253+
if(!$('body').hasClass('BlueTopBack')) { //No Pjax for BO.
254+
pjax.connect(pjax_config());
255+
}
256+
};
257+
258+
var load_with_pjax = function(url) {
259+
if(page.url.is_in(new URL(url))) {
260+
return;
261+
}
262+
263+
var config = pjax_config();
264+
config.url = url;
265+
config.update_url = url;
266+
config.history = true;
267+
pjax.invoke(config);
268+
};
269+
270+
// Reduce duplication as required Auth is a common pattern
271+
var pjax_config_page_require_auth = function(url, exec) {
272+
var oldOnLoad = exec().onLoad;
273+
var newOnLoad = function() {
274+
if (!page.client.show_login_if_logout(true)) {
275+
oldOnLoad();
276+
}
277+
};
278+
279+
var newExecFn = function(){
280+
return {
281+
onLoad: newOnLoad,
282+
onUnload: exec().onUnload
283+
};
284+
};
285+
pjax_config_page(url, newExecFn);
286+
};
287+
288+
var onLoad = new PjaxExecQueue();
289+
var onUnload = new PjaxExecQueue();
290+
291+
init_pjax(); //Pjax-standalone will wait for on load event before attaching.
292+
$(function() { onLoad.fire(); });
293+
294+
module.exports = {
295+
pjax_config_page_require_auth: pjax_config_page_require_auth,
296+
pjax_config_page: pjax_config_page,
297+
load_with_pjax: load_with_pjax,
298+
PjaxExecQueue: PjaxExecQueue,
299+
onLoad: onLoad,
300+
onUnload: onUnload,
301+
};
302+
303+
304+
/***/ },
305+
/* 3 */
306+
/***/ function(module, exports, __webpack_require__) {
307+
308+
var getAppId = __webpack_require__(1).getAppId;
309+
var getSocketURL = __webpack_require__(1).getSocketURL;
310+
var pjax_config_page = __webpack_require__(2).pjax_config_page;
311+
312+
pjax_config_page("endpoint", function(){
313+
return {
314+
onLoad: function() {
315+
$('#server_url').val(getSocketURL().split('/')[2]);
316+
$('#app_id').val(getAppId());
317+
$('#new_endpoint').on('click', function () {
318+
var server_url = ($('#server_url').val() || '').trim().toLowerCase(),
319+
app_id = ($('#app_id').val() || '').trim();
320+
if (server_url) {
321+
if(!/^(ws|www2|www|blue|green)\..*$/i.test(server_url)) server_url = 'www.' + server_url;
322+
localStorage.setItem('config.server_url', server_url);
323+
}
324+
if (app_id && !isNaN(app_id)) localStorage.setItem('config.app_id', parseInt(app_id));
325+
window.location.reload();
326+
});
327+
$('#reset_endpoint').on('click', function () {
328+
localStorage.removeItem('config.server_url');
329+
localStorage.removeItem('config.app_id');
330+
window.location.reload();
331+
});
332+
}
333+
};
334+
});
335+
336+
337+
/***/ }
338+
/******/ ]);

src/sass/all.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/* common styles */
44
@import 'reset';
55
@import 'mixin';
6+
@import 'functions';
67
@import 'common';
78
@import 'animations';
89

src/sass/common/accordion.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
background-position: left !important;
55
}
66
h3.ui-state-default {
7-
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><defs><style>.cls-1{fill:#{rgba($COLOR_BLUE, 1)};}</style></defs><title>arrow_left</title><path class="cls-1" d="M15.7,16.59,11.125,12,15.7,7.41,14.3,6l-6,6,6,6Z"/></svg>');
7+
background-image: svg-url('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#{rgba($COLOR_BLUE, 1)}" d="M15.7,16.59,11.125,12,15.7,7.41,14.3,6l-6,6,6,6Z"/></svg>');
88
}
99
}
1010
.ui-accordion-content {

0 commit comments

Comments
 (0)