Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:48:54+00:00 2026-06-13T19:48:54+00:00

I have a Greasemonkey script (original thread here: Javascript to grab Javascript comments within

  • 0

I have a Greasemonkey script (original thread here: Javascript to grab Javascript comments within <head>) that grabs a string from a webpage – a PageID that our CMS stamps on pages – and this string is then displayed in my browser using Greasemonkey. The purpose of this is for website maintenance so I can browse our website and quickly see what PageID a specific page is. The code used to achieve this is:

var commentNode = [].slice.call(document.head.childNodes).filter(function(node) {
            return node.nodeType == 8;
          })[0],
    id = commentNode.data.match(/^\s*(\d+)/)[1];

var elem = document.createElement('div');
elem.id = 'id-display';
elem.appendChild(document.createTextNode(id));
document.body.appendChild(elem);

GM_addStyle = function(css) {
        var head = document.getElementsByTagName('head')[0], style = document
                .createElement('style');
        if (!head) {
            return
        }
        style.type = 'text/css';
        style.textContent = css;
        head.appendChild(style);
}

This displays in my browser (Chrome or Firefox w/ Greasemonkey) as:

Page ID: 0001

I now have a separate HTML report that publishes from our CMS in the following format:

<table class="report-table">
 <thead>
    <tr>
      <th scope="col">Page Id</th>
      <th scope="col">Page title</th>
      <th scope="col">Page URL</th>
      <th scope="col">Content Editor</th>
      <th scope="col">Content manager</th>
      <th scope="col">Date updated</th>     
    </tr>
  </thead>
    <tr>
     <td>0001</td>
     <td>Webpage title</td>
     <td><a href="http://www.website.com/page01.htm">www.website.com/page01.htm</a></td>
     <td>Joe Bloggs</td>
     <td>Sussan Smith</td>
     <td>01/11/2012</td>
   </tr>
</table>

This webpage report is saved in an internally accessible location \internal-pc\cms-report.html

What I would like to do now is for my Greasemonkey to still grab the PageID string and to then lookup this PageID against the table in cms-report.html and to then display this information in the Greasemonkey overlay as:

Page ID: 0001
Page title: Webpage title
Page URL: www.website.com/page01.htm
Content Editor: Joe Bloggs
Content manager: Sussan Smith
Date Updated: 01/11/2012

Can anyone lead me down the right path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:48:56+00:00Added an answer on June 13, 2026 at 7:48 pm

    Using jQuery and assuming you have the page id available in a variable pID and a result div #result:

    var pID = '0001';
    $(function(){
        $.get('internal-pc/cms-report.html', function(data){
            var table = $(data),
                selectedTD = table.find('td:contains("' + pID + '")'),
                parentTR = selectedTD.parent();
                parentTR.find('td').each(function(i){
                    $('#result').append('<p>' + table.find('th:eq(' + i + ')').text() + ': ' + $(this).text() + '</p>');
                });
        });         
    });
    

    Note: You will need to modify the $.get URL to point to your cms-report.html file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a greasemonkey script that opens an iframe containing a form from a
So, I have GreaseMonkey Script that does some operations with integers and then sets
I have a Greasemonkey script that dynamically inserts an HTML form into some web
I have created a Greasemonkey script that runs fine in the firebug editor, with
I have a very simple greasemonkey script that I want to call an already
Do you have any link\example of Greasemonkey script with Jquery that works in Google
I have a simple greasemonkey script that makes some simple dom manipulation. The greasemonkey
I have a Greasemonkey script that prints a div -- works! However, I'd like
I have this Greasemonkey script that works fine in the Fiddle. It's designed to
So I have a greasemonkey script that I am adding onto, and one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.