Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const otherCookie = Cookie.noConflict();
otherCookie.set('name', 'OtherCookie');
const cookieWithConverter = otherCookie.withConverter((value: string, name: string): string => {
return value;
});
cookieWithConverter.defaults = {
secure: true
};
// $ExpectError
Cookie.defaults = {
secure: 1
};
if (!defaultLangId) {
if (options.languages["c++"]) {
defaultLangId = "c++";
} else {
defaultLangId = _.keys(options.languages)[0];
}
}
// Cookie domains are matched as a RE against the window location. This allows a flexible
// way that works across multiple domains (e.g. godbolt.org and compiler-explorer.com).
// We allow this to be configurable so that (for example), gcc.godbolt.org and d.godbolt.org
// share the same cookie domain for some settings.
var cookieDomain = new RegExp(options.cookieDomainRe).exec(window.location.hostname);
if (cookieDomain && cookieDomain[0]) {
cookieDomain = cookieDomain[0];
jsCookie.defaults.domain = cookieDomain;
}
var defaultConfig = {
settings: {showPopoutIcon: false},
content: [{
type: 'row',
content: [
Components.getEditor(1, defaultLangId),
Components.getCompiler(1, defaultLangId)
]
}]
};
$(window).bind('hashchange', function () {
// punt on hash events and just reload the page if there's a hash
if (window.location.hash.substr(1)) window.location.reload();
document.addEventListener('DOMContentLoaded', () => {
const $body = $('body');
const $document = $(document);
const bootstrapBreakpoint = bp.getBreakpointSize();
initUserTracking();
initLayoutNav();
initAlertHandler();
// Set the default path for all cookies to GitLab's root directory
Cookies.defaults.path = gon.relative_url_root || '/';
// `hashchange` is not triggered when link target is already in window.location
$body.on('click', 'a[href^="#"]', function clickHashLinkCallback() {
const href = this.getAttribute('href');
if (href.substr(1) === getLocationHash()) {
setTimeout(handleLocationHash, 1);
}
});
/**
* TODO: Apparently we are collapsing the right sidebar on certain screensizes per default
* except on issue board pages. Why can't we do it with CSS?
*
* Proposal: Expose a global sidebar API, which we could import wherever we are manipulating
* the visibility of the sidebar.
*
set defaults(defaults) {
cook.defaults = defaults;
}
get defaults() {
return cook.defaults;
}