How to add a Bookmark Script

Demo recording: https://drive.google.com/file/d/1rY68SI0W8ik4koLtUWJCGDadjwVRA5cH/view
 
 How to Use This Script

  1. Copy the code block above.
  2. In your browser (Chrome is shown in the video), open your Bookmark Manager.
  3. Right-click and select Add New Bookmark.
  4. Name: CMS EDITOR (or your preferred name).
  5. URL: Paste the entire script into the URL field.
  6. Important: Replace PROPERTYID in the script with the specific property ID number for the site you are working on (as shown in the list at 00:34 in the video).

To find your PROPERTYID create a new article in the CMS and the PROPERTYID will show up on the URL bar.



In this example, we are showing the "all_trail_blazers" as the property ID for Portland Trailblazers on SI (https://www.si.com/nba/trailblazers/onsi)

 

javascript:(function() {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://code.jquery.com/jquery-3.6.0.min.js';
  script.onload = function() {
    var innerScript = document.createElement('script');
    innerScript.textContent = `
        window.nmvClientApi.push(['getPageData', pageDataObject => {
            const resourceID = pageDataObject.resourceID;
            const baseURL = "https://mmsport.voltax.io/cms/editor/PROPERTYNUMBER";
            const newURL = baseURL + resourceID;
            const tempInput = document.createElement('input');
            tempInput.value = resourceID;
            document.body.appendChild(tempInput);
            tempInput.select();
            document.execCommand('copy');
            document.body.removeChild(tempInput);
            const choice = confirm("The article ID is now copied to your clipboard. Click OK to go to edit this article in Voltax, or click Cancel to continue.");
            if (choice) {
                window.location.href = newURL;
            }
        }]);
    `;
    document.body.appendChild(innerScript);
  };
  document.body.appendChild(script);
})();