How to use the mithril.parseQueryString function in mithril

To help you get started, we’ve selected a few mithril examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tutao / tutanota / src / app.js View on Github external
.then(module => module.login), false)
	let settingsViewResolver = createViewResolver(() => _asyncImport("src/settings/SettingsView.js")
		.then(module => new module.SettingsView()))
	let searchViewResolver = createViewResolver(() => _asyncImport("src/search/SearchView.js")
		.then(module => new module.SearchView()))
	let contactFormViewResolver = createViewResolver(() => _asyncImport("src/login/ContactFormView.js")
		.then(module => module.contactFormView), false)
	const calendarViewResolver = createViewResolver(() => _asyncImport("src/calendar/CalendarView.js")
		.then(module => new module.CalendarView()), true)

	let start = "/"
	if (!state.prefix) {
		state.prefix = location.pathname[location.pathname.length - 1] !== '/'
			? location.pathname : location.pathname.substring(0, location.pathname.length - 1)

		let query = m.parseQueryString(location.search)
		let redirectTo = query['r'] // redirection triggered by the server (e.g. the user reloads /mail/id by pressing F5)
		if (redirectTo) {
			delete query['r']
		} else {
			redirectTo = ""
		}
		let newQueryString = m.buildQueryString(query)
		if (newQueryString.length > 0) {
			newQueryString = "?" + newQueryString
		}
		let target = redirectTo + newQueryString + location.hash
		if (target === "" || target[0] !== "/") target = "/" + target
		history.replaceState(null, "", neverNull(state.prefix) + target)
		start = target
	}
	m.route.prefix = neverNull(state.prefix)
github gocd / gocd / server / webapp / WEB-INF / rails / webpack / single_page_apps / new_dashboard.js View on Github external
function queryObject() {
    return m.parseQueryString(window.location.search);
  }
github Cistern / cistern / ui / js / ChartContainer.js View on Github external
oninit: function(vnode) {

    var queryString = m.parseQueryString(window.location.search.replace(/^[?]/, ''))
    var start = new Date(), end = new Date();
    if (queryString.start) {
      start = new Date(queryString.start)
    }
    if (queryString.end) {
      end = new Date(queryString.end)
    }

    var data = {
      series: [],
      query: {
        time_range: {
          start: new Date(),
          end: new Date()
        }
      }
github catarse / catarse / catarse.js / legacy / src / h.ts View on Github external
setAndResetMultParamsArray = (/** @type {{[key : string] : string | number}} */ setParams, /** @type {string[]}*/ removeQuery = []) => {

        /** @type {Object} */
        const query = m.parseQueryString(window.location.search);

        removeQuery.forEach(param => {
            if (param in query) {
                delete query[param];
            }
        });

        const queryString = objectToSearchString(Object.assign(query, setParams));

        const newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + queryString + (window.location.hash === '#' ? '' : window.location.hash);
        m.route.set(newurl);
    },
    removeParamByName = (name) => {
github Cistern / cistern / ui / js / ChartContainer.js View on Github external
vnode.state.updateURL = function() {
        var queryString = m.parseQueryString(window.location.search.replace(/^[?]/, ''))
        queryString.start = this.start.toJSON()
        queryString.end = this.end.toJSON()
        queryString.query = this.query
        queryString.collection = this.collection

        var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + m.buildQueryString(queryString);
        window.history.pushState({path: newurl}, '', newurl);
      }.bind(this)
github gocd / gocd / server / webapp / WEB-INF / rails.new / webpack / single_page_apps / new_dashboard.js View on Github external
function queryObject() {
    return m.parseQueryString(window.location.search);
  }
github google / perfetto / ui / src / frontend / router.ts View on Github external
static param(key: string) {
    const hash = window.location.hash;
    const paramStart = hash.indexOf('?');
    if (paramStart === -1) return undefined;
    return m.parseQueryString(hash.substring(paramStart))[key];
  }
}