var absoluteUrl = "https://kwalificatie-mijn.s-bb.nl"; if (!String.prototype.format) { String.prototype.format = function () { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp("\\{" + i + "\\}", "gm"), arguments[i]); } return s; }; } if (!String.prototype.pformat) { String.prototype.pformat = function (placeholders) { var s = this; for (var propertyName in placeholders) { var re = new RegExp("{" + propertyName + "}", "gm"); s = s.replace(re, placeholders[propertyName]); } return s; }; } $(function () { // zet module & labels initModule({ module: "KwalificatieRegister", labels: [] }); // event handling voor taal switch $(document).on("LanguageChange", function (e) { var url = "{0}/UI/ChangeLanguage?lang={1}".format(absoluteUrl, e.message); $.ajax({ url: url, cache: false, cancelExisting: true, success: function (data) { var reloadurl = $("#reload-url").val(); if (reloadurl) { location.replace(reloadurl); } else { location.reload(); } }, error: function (data, error) { console.log(error); } }); }); // event handling voor organisatie switch $(document).on("OrganisatieChange", function (e) { location.reload(); }); if ($("#niet-ingelogd").length) { $(".sbb-logo").find("a").prop("href", absoluteUrl); } initRippleEffect(); initDotDotDot(); }); function setCookie(cname, cvalue) { document.cookie = cname + "=" + cvalue; } function getCookie(cname) { var name = cname + "=", decodedCookie = decodeURIComponent(document.cookie), ca = decodedCookie.split(";"); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === " ") { c = c.substring(1); } if (c.indexOf(name) === 0) { return c.substring(name.length, c.length); } } return ""; } function getQueryVariable(variable) { var query = window.location.search.substring(1), vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] === variable) { return vars[i].replace("{0}=".format(variable), ""); } } return false; } function gaNaarLocatie(controller, type, titel, id) { window.location.href = "{absoluteUrl}/{type}/{titel}/?id={id}".pformat({ absoluteUrl: absoluteUrl, controller: controller, type: type.toLowerCase(), titel: filterIllegalPathCharacters(titel), id: btoa(id) }); } function doAjaxCall(url, data) { return $.ajax({ url: absoluteUrl + url, method: "GET", cache: false, data: data }).fail(function (jqXHR, textStatus) { var error = jqXHR.responseText === "" ? "Onbekende fout" : jqXHR.responseText, document = $("#FrmError")[0].contentWindow.document; document.open(); document.write(error); document.close(); $("#MyErrorModal").modal("show"); }); } function hasEvent($elm, eventname) { var events = $._data($elm[0], "events"); $.each(events, function (name, handler) { if (name === eventname) return true; }); return false; } function initRippleEffect() { $(".ripple").on("click", function () { arguments[0].preventDefault(); var $this = $(this), $div = $("
"), thisheight = $this.height(), btnOffset = $this.offset(), xPos = arguments[0].pageX - btnOffset.left, yPos = arguments[0].pageY - btnOffset.top; $div.addClass("ripple-effect"); var $ripple = $(".ripple-effect"); $ripple.css("width", thisheight).css("height", thisheight); $div.css({ top: yPos - $ripple.height() / 2, left: xPos - $ripple.width() / 2, background: $this.data("ripple-color") }).appendTo($this); window.setTimeout(function () { $div.remove(); }, 2000); }); } function initDotDotDot() { $(".dotdotdot").dotdotdot(); } function check(value) { return !!value; } // used with the divs at the bottom of the page to test which viewport is used in bootstrap (alias: xs, sm, md, lg) function isBreakpoint(alias) { return $(".device-" + alias).is(":visible"); } function filterIllegalPathCharacters(input) { return input.replace(/[&\/\\+()%:*?<>{}"]/g, " ").trim(); }