function DisplayError() { var error = "" document.getElementById("errorField").innerHTML = error; } function setActivePage() { var rawPath = window.location.pathname; if (rawPath.indexOf("PS4") || rawPath.indexOf("PS3") || rawPath.indexOf("VITA") >= 0) { return; } else { if (rawPath.indexOf("PS4") >= 0) { var sectionPath = "#PS4"; var pagePath = "#" + rawPath.split("/").pop(); } else if (rawPath.indexOf("PS3") >= 0) { var sectionPath = "#PS3"; var pagePath = "#" + rawPath.split("/").pop(); } else if (rawPath.indexOf("VITA") >= 0) { var sectionPath = "#VITA"; var pagePath = "#" + rawPath.split("/").pop(); } else { var pagePath = rawPath.replace('/', '#'); } if (sectionPath !== null) { $(sectionPath).addClass('active'); } $(pagePath).addClass('active'); } } function deletePrompt(id, name) { var path = window.location.pathname; var url = path + "?id=" + id + "&action=delete"; bootbox.confirm({ message: "Are you sure?

Do you really want to delete " + name + "? This cannot be undone.", closeButton: false, buttons: { cancel: { label: ' Cancel', className: 'btn-secondary' }, confirm: { label: ' Confirm', className: 'btn-danger' } }, callback: function (result) { if (result == true) { window.location = url; } } }).find('.modal-content').css({'background-color': '#343a40'}); } function editPrompt(id) { var path = window.location.pathname; var url = path + "?id=" + id + "&action=edit"; bootbox.confirm({ message: $(".edit-form").html(), closeButton: false, buttons: { cancel: { label: ' Cancel', className: 'btn-secondary' }, confirm: { label: ' Confirm', className: 'btn-danger' } }, callback: function (result) { if (result == true) { window.location = url; } } }).find('.modal-content').css({'background-color': '#343a40'}); } function copyToClipboard(text, el) { var copyTest = document.queryCommandSupported('copy'); var elOriginalText = el.attr('data-original-title'); if (copyTest === true) { var copyTextArea = document.createElement("textarea"); copyTextArea.value = text; document.body.appendChild(copyTextArea); copyTextArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'Copied to clipboard !' : 'Whoops, not copied!'; el.attr('data-original-title', msg).tooltip('show'); } catch (err) { console.log('Oops, unable to copy'); } document.body.removeChild(copyTextArea); el.attr('data-original-title', elOriginalText); } else { // Fallback if browser doesn't support .execCommand('copy') window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text); } } // Document ready $(document).ready(function () { $('[data-toggle="tooltip"]').tooltip({ container: '#tooltip-enabler' }); $('.js-copy').click(function() { var text = $(this).attr('data-copy'); var el = $(this); copyToClipboard(text, el); }); setActivePage(); });