Example JavaScript For Customization of the User Web Interface

KB Home   |   Example JavaScript For Customization of the User Web Interface

Main.TailoredWebToolsExampleScripts History

Hide minor edits - Show changes to output

Changed line 11 from:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file. If running version 17.2 or above, it must be created in @header3.inc@@.
to:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file. If running version 17.2 or above, it must be created in @@header3.inc@@.
August 25, 2017, at 06:42 PM by priyanka - Updated information based on the changes done for Tailored Web Tools in 17.2
Changed lines 8-9 from:
to:
If running version 17.2 or above, it should placed in @@footer3.inc@@.
Changed lines 11-12 from:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file).
to:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file. If running version 17.2 or above, it must be created in @header3.inc@@.
).
July 11, 2017, at 04:34 AM by peterf - Updating to reflect obsolescence of suggested changes with 17.2
Changed lines 1-5 from:
(:title Example JavaScript For Customization of the User Web Tools Interface:)

The following are example JavaScript snippets that can be used to customize the [[WebTools | user web tools]] interface.  Functions from the JavaScript library [[http://docs.jquery.com/ | JQuery]] are used in many of the examples below.  Documentation on the JQuery site may assist with additional customization.

The snippets below are best placed in the @@footer2.inc@@ file for user web tools customization.  See the article [[TailoredWebTools | +]] for more details.
to:
(:title Example JavaScript For Customization of the User Web Interface:)

The following are example JavaScript snippets that can be used to customize the [[https://www.papercut.com/products/ng/manual/clienttool/topics/user-services-web.html|User web interface]].  Functions from the JavaScript library [[http://docs.jquery.com/ | JQuery]] are used in many of the examples below.  Documentation on the JQuery site may assist with additional customization.

'''Please Note:''' These examples are oriented towards customising the User web interface in releases of PaperCut NG and PaperCut MF prior to version 17.2. As of version 17.2, the User web interface has been refreshed, so the following suggested modifications may no longer be relevant. See the following section of the user manual for information on CSS modification for more recent versions of the application: [[https://www.papercut.com/products/ng/manual/common/topics/customize-user-web-pages.html|Customize the User web interface]]

The snippets below are best placed in the @@footer2.inc@@ file for User web interface customization.
April 11, 2016, at 05:04 AM by jamesv - Made correction for "Removing the Recent Print Jobs link from the navigation menu" code
Changed line 168 from:
     ('#linkUserPrintLogs').parents('li:first').remove();
to:
     $('#linkUserPrintLogs').remove();
Changed line 166 from:
     // Change the name below to match the link you'd like to put on the top
to:
     // Removing the Recent Print Jobs link from the navigation menu
Added lines 157-173:


!! Hiding a navigation menu

This example will move "Recent Print Jobs" menu item from the list

[@
<script type="text/javascript">
  $(function() {
    // Change the name below to match the link you'd like to put on the top
   
    ('#linkUserPrintLogs').parents('li:first').remove();

  });
</script>
@]

December 22, 2014, at 10:16 PM by tom - re-order based on obscurity
Changed lines 7-9 from:
!! Disabling 'refund request' options for print jobs based on server
In a multi-tenancy scenario, some customer may be interested in disabling the refund request links for jobs sent via selected servers
.
to:
!! Moving logged-in-as into the header
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file)
.
Changed lines 12-33 from:
 var disableRefundOnServers = [
//Create a collection of servers to disable the refund request option for
 
'marketing-server',
 
'science-server'
 ];

 $(function() {
//If the title of the page is 'Recent Print Jobs'
  if ($('#main h1').text() == 'Recent Print Jobs') {
//For each printer display name column in the data table
  $('table.results td.printerDisplayNameColumnValue').each(function() {
//Use string functions to extract the printer name
    var printerFullName = $(this).text().trim();
    var serverName = printerFullName.substring(0, printerFullName.indexOf('\\'));
//If the printer name is in the collection of servers to disable links for
    if ($.inArray(serverName, disableRefundOnServers) >= 0) {
//Traverse up and down the DOM for the table to find the refund link and remove it
    $(this).closest('tr').find('td.statusColumnValue a:contains(request refund)').closest('td').remove();
    }
  });
  }

 });
to:
  $(function() {
    $('#logged-in-as').remove().insertAfter('#header-logo');
  });
Changed lines 18-20 from:
!! Removing the server-name from the printers list in Web Print
Some customers want to remove the server name in the Web Print printer list mainly because server names are often confusing. Others may have security concerns.

to:

!! Adding an extra navigation menu item
Changed lines 23-33 from:
   $('.web-print-printer-list td.displayNameColumnValue label').contents().filter(function() {
 
// text nodes only (so as to avoid selecting the radio button)
      return this.nodeType == 3;
    }).each(function() {
  var text = $(this).text().trim();
  // There is a text node before the radio button. Ignore it.
  if (text.length > 0) {
    var printerName = text.substring(text.indexOf('\\') + 1);
$(this).replaceWith(printerName);
      }
    }
);
to:
   $('#nav ul').append('<li><a href="/help">Help</a></li>');
Changed lines 28-30 from:
!! Moving logged-in-as into the header
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file).

to:

!! Change the label of a navigation menu item
Changed line 33 from:
   $('#logged-in-as').remove().insertAfter('#header-logo');
to:
   $('#linkUserTopUpCards').text('Activate Card');
Changed lines 38-39 from:
!! Adding an extra navigation menu item
to:

!! Adding text to a page
Changed lines 43-45 from:
   $('#nav ul').append('<li><a href="/help">Help</a></li>');
to:
   if ($('#main h1').text() == 'Transfers') {
      $('#main h1').after(
"<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
    }
Changed lines 50-51 from:
!! Change the label of a navigation menu item
to:

!! Hiding data table columns
Changed lines 55-58 from:
   $('#linkUserTopUpCards').text('Activate Card');
to:
   $('th.accountNameColumnHeader').hide();
    $(
'td.accountNameColumnValue').hide();
    $('th.printerDisplayNameColumnHeader').hide();
    $('td.printerDisplayNameColumnValue').hide(
);
Changed lines 63-66 from:
!! Adding text to a page
to:

!! Removing the server-name from the printers list in Web Print
Some customers want to remove the server name in the Web Print printer list mainly because server names are often confusing. Others may have security concerns.

Changed lines 70-72 from:
   if ($('#main h1').text() == 'Transfers') {
     $('#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
    }
to:
   $('.web-print-printer-list td.displayNameColumnValue label').contents().filter(function() {
  // text nodes only (so as to avoid selecting the radio button)
     return this.nodeType == 3;
    }).each(function() {
  var text = $(this).text().trim();
  // There is a text node before the radio button. Ignore it.
  if (text.length > 0) {
    var printerName = text.substring(text.indexOf('\\') + 1);
$(this).replaceWith(printerName);
      }
    });
Changed lines 85-86 from:
!! Hiding data table columns
to:

!! Removing user balance and the balance graph (Version 12 and later)
Deleted lines 89-101:
   $('th.accountNameColumnHeader').hide();
    $('td.accountNameColumnValue').hide();
    $('th.printerDisplayNameColumnHeader').hide();
    $('td.printerDisplayNameColumnValue').hide();
  });
</script>
@]


!! Removing user balance and the balance graph (Version 12 and later)
[@
<script type="text/javascript">
  $(function() {
Added lines 171-200:
!! Disabling 'refund request' options for print jobs based on server
In a multi-tenancy scenario, some customer may be interested in disabling the refund request links for jobs sent via selected servers.

[@
<script type="text/javascript">
 var disableRefundOnServers = [
  //Create a collection of servers to disable the refund request option for
  'marketing-server',
  'science-server'
 ];

 $(function() {
  //If the title of the page is 'Recent Print Jobs'
  if ($('#main h1').text() == 'Recent Print Jobs') {
  //For each printer display name column in the data table
  $('table.results td.printerDisplayNameColumnValue').each(function() {
    //Use string functions to extract the printer name
    var printerFullName = $(this).text().trim();
    var serverName = printerFullName.substring(0, printerFullName.indexOf('\\'));
    //If the printer name is in the collection of servers to disable links for
    if ($.inArray(serverName, disableRefundOnServers) >= 0) {
      //Traverse up and down the DOM for the table to find the refund link and remove it
    $(this).closest('tr').find('td.statusColumnValue a:contains(request refund)').closest('td').remove();
    }
  });
  }
 });
</script>
@]

December 22, 2014, at 10:04 PM by 203.222.91.204 -
Changed lines 7-10 from:

!! Removing the server-name from the printers list in Web Print
Some customers want to remove the server name
in the Web Print printer list mainly because server names are often confusing. Others may have security concerns.
to:
!! Disabling 'refund request' options for print jobs based on server
In a multi-tenancy scenario, some customer may be interested
in disabling the refund request links for jobs sent via selected servers.
Added lines 12-41:
 var disableRefundOnServers = [
//Create a collection of servers to disable the refund request option for
  'marketing-server',
  'science-server'
 ];

 $(function() {
//If the title of the page is 'Recent Print Jobs'
  if ($('#main h1').text() == 'Recent Print Jobs') {
//For each printer display name column in the data table
  $('table.results td.printerDisplayNameColumnValue').each(function() {
//Use string functions to extract the printer name
    var printerFullName = $(this).text().trim();
    var serverName = printerFullName.substring(0, printerFullName.indexOf('\\'));
//If the printer name is in the collection of servers to disable links for
    if ($.inArray(serverName, disableRefundOnServers) >= 0) {
//Traverse up and down the DOM for the table to find the refund link and remove it
    $(this).closest('tr').find('td.statusColumnValue a:contains(request refund)').closest('td').remove();
    }
  });
  }
 });
</script>
@]

!! Removing the server-name from the printers list in Web Print
Some customers want to remove the server name in the Web Print printer list mainly because server names are often confusing. Others may have security concerns.

[@
<script type="text/javascript">
Changed line 12 from:
<script>
to:
<script type="text/javascript">
November 18, 2014, at 10:24 PM by Jason - Thanks Tom C! :-)
Changed lines 8-10 from:
!! Moving logged-in-as into the header
Moves the section that shows the currently logged in user from the footer to
the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file).
to:
!! Removing the server-name from the printers list in Web Print
Some customers want to remove the server name in
the Web Print printer list mainly because server names are often confusing. Others may have security concerns.
Changed line 12 from:
<script type="text/javascript">
to:
<script>
Changed lines 14-24 from:
   $('#logged-in-as').remove().insertAfter('#header-logo');
to:
   $('.web-print-printer-list td.displayNameColumnValue label').contents().filter(function() {
  // text nodes only (so as to avoid selecting the radio button)
      return this.nodeType == 3;
    }).each(function() {
  var text = $(this).text().trim();
  // There is a text node before the radio button. Ignore it.
  if (text.length > 0) {
    var printerName = text.substring(text.indexOf('\\') + 1);
$(this).replaceWith(printerName);
      }
    }
);
Changed lines 29-31 from:
!! Adding an extra navigation menu item
to:
!! Moving logged-in-as into the header
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file).

Changed line 35 from:
   $('#nav ul').append('<li><a href="/help">Help</a></li>');
to:
   $('#logged-in-as').remove().insertAfter('#header-logo');
Changed line 40 from:
!! Change the label of a navigation menu item
to:
!! Adding an extra navigation menu item
Changed line 44 from:
   $('#linkUserTopUpCards').text('Activate Card');
to:
   $('#nav ul').append('<li><a href="/help">Help</a></li>');
Changed line 49 from:
!! Adding text to a page
to:
!! Change the label of a navigation menu item
Changed lines 53-55 from:
   if ($('#main h1').text() == 'Transfers') {
      $('#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>")
;
    }
to:
   $('#linkUserTopUpCards').text('Activate Card');
Changed line 58 from:
!! Hiding data table columns
to:
!! Adding text to a page
Changed lines 62-65 from:
   $('th.accountNameColumnHeader').hide();
    $('td.accountNameColumnValue').hide();
    $(
'th.printerDisplayNameColumnHeader').hide();
    $('td.printerDisplayNameColumnValue').hide();
to:
   if ($('#main h1').text() == 'Transfers') {
     
$('#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
    }
Changed lines 69-70 from:

!! Removing user balance and the balance graph (Version 12 and later)
to:
!! Hiding data table columns
Added lines 73-85:
   $('th.accountNameColumnHeader').hide();
    $('td.accountNameColumnValue').hide();
    $('th.printerDisplayNameColumnHeader').hide();
    $('td.printerDisplayNameColumnValue').hide();
  });
</script>
@]


!! Removing user balance and the balance graph (Version 12 and later)
[@
<script type="text/javascript">
  $(function() {
April 10, 2014, at 11:45 PM by TimG - Updated to add a new section for the javascript changes for hiding balance/graph post version 12.
Changed lines 60-61 from:
!! Removing user balance and the balance graph
to:

!! Removing user balance and the balance graph (Version 12 and later)
Changed lines 72-73 from:
     $('#main h1:eq(1)').next().hide();
      $('#main h1:eq(1)').hide();
to:
     $('#main h2:eq(0)').next().hide();
      $('#main h2:eq(0)').hide();
Changed lines 79-81 from:
!! Replacing 'Balance' with 'MB Remaining'
Changes
the displayed balance on the Summary page into a displayed 'MB Remaining'.  Uses a specified cost per MB to perform the calculation.
to:

!! Removing user balance and the balance graph (pre Version 12)
Changed lines 84-91 from:
   var costPerMB = 0.20;
    var balance =
$('table.userDataTable tbody tr:eq(1) td').text().replace(/[^\d\.]/g, "");
    var mb = balance / costPerMB;

    // change heading
    $('table.userDataTable tbody tr:eq(1
) th').text("MB Remaining");
    // change value
    $(
'table.userDataTable tbody tr:eq(1) td').text(mb + " MB");
to:
   // check that we're on the Summary page
 
   if ($('#main h1:eq(0)').text() == 'Summary') {
     // hide the current balance display (blanks out the second row in the table)
      $('table.userDataTable tbody tr:eq(1) th').text("");
 
    $('table.userDataTable tbody tr:eq(1) td').text("");

      // remove the activity heading and balance graph (hides the second heading and following section on the page)
      $('#main h1:eq(1)').next().hide();
      $('#main h1:eq(1)').hide();
    }
Changed lines 98-101 from:
!! Change the order of the navigation menu links

This example will move "Web Print" menu item to the top of the list.

to:
!! Replacing 'Balance' with 'MB Remaining'
Changes
the displayed balance on the Summary page into a displayed 'MB Remaining'.  Uses a specified cost per MB to perform the calculation.
Changed lines 104-109 from:
    // Change the name below to match the link you'd like to put on the top
     var LINK_TO_MOVE = "Web Print";
   
    var $navList =  $('div#nav').find('ul');
    var $linkToMove = $navList.find(":contains('" + LINK_TO_MOVE + "')").parents('li');
    $navList.prepend($linkToMove);
to:
   var costPerMB = 0.20;
    var balance = $(
'table.userDataTable tbody tr:eq(1) td').text().replace(/[^\d\.]/g, "");
 
  var mb = balance / costPerMB;

    // change heading
    $('table.userDataTable tbody tr:eq(1) th').text("MB Remaining");
    // change value
    $('table.userDataTable tbody tr:eq(1) td').text(mb + " MB");
Changed lines 116-117 from:
The example below will change order of the navigation menu links using the link Ids. This will move the 'Jobs Pending Release' link below the 'Summary' link.
to:
!! Change the order of the navigation menu links

This example will move "Web Print" menu item to
the top of the list.
Changed lines 122-125 from:
 $(function() {
  $('#linkUserReleaseJobs').parents('li:first')
                        .remove()
                         .insertAfter($('#linkUserSummary').parents('li:first'));
to:
  $(function() {
    // Change the name below to match the link you'd like to put on the top
    var LINK_TO_MOVE = "Web Print";
   
    var $navList =  $('div#nav').find('ul');
    var $linkToMove = $navList.find(":contains('" + LINK_TO_MOVE + "')").parents('li');
    $navList.prepend($linkToMove
);
Changed lines 133-145 from:
to:
The example below will change order of the navigation menu links using the link Ids. This will move the 'Jobs Pending Release' link below the 'Summary' link.

[@
<script type="text/javascript">
 $(function() {
  $('#linkUserReleaseJobs').parents('li:first')
                          .remove()
                          .insertAfter($('#linkUserSummary').parents('li:first'));
  });
</script>
@]

Changed lines 98-99 from:
This example will move "Web Print" menu item the top of the list.
to:
This example will move "Web Print" menu item to the top of the list.
Changed lines 96-97 from:
!! Change the order of the Navigation menu links
to:
!! Change the order of the navigation menu links
Changed lines 113-114 from:
Changes the order of the navigation menu links using the link Ids. This will move the 'Jobs Pending Release' link below the 'Summary' link.
to:
The example below will change order of the navigation menu links using the link Ids. This will move the 'Jobs Pending Release' link below the 'Summary' link.
Changed lines 98-99 from:
This example will move Web Print menu to the top of the navigation menu.
to:
This example will move "Web Print" menu item the top of the list. 

[@
<script type="text/javascript">
Changed lines 110-114 from:


Changes the order of the navigation menu links using the link IDS.
This will move the 'Jobs Pending Release' link below the 'Summary' link.
to:
</script>
@]

Changes the order of the navigation menu links using the link Ids. This will move the 'Jobs Pending Release' link below the 'Summary' link.
Changed lines 96-99 from:
!! Move the 'Jobs Pending Release' link below the 'Summary' link

Changes the order of the navigation
menu links.
to:
!! Change the order of the Navigation menu links

This example will move Web Print
menu to the top of the navigation menu.

  $(function() {
    // Change the name below to match the link you'd like to put on the top
    var LINK_TO_MOVE = "Web Print";
   
    var $navList =  $('div#nav').find('ul');
    var $linkToMove = $navList.find(":contains('" + LINK_TO_MOVE + "')").parents('li');
    $navList.prepend($linkToMove);
  });


Changes the order of the navigation menu links using the link IDS.
This will move the 'Jobs Pending Release' link below the 'Summary' link.

Changed lines 98-99 from:
Changes the order of the links.
to:
Changes the order of the navigation menu links.
Changed lines 96-98 from:
!! Move the 'Jobs Pending Release' link above the 'Transfers' link
to:
!! Move the 'Jobs Pending Release' link below the 'Summary' link

Changes the order of the links.
Changed line 104 from:
                           .insertBefore($('#linkUserTransfer').parents('li:first'));
to:
                           .insertAfter($('#linkUserSummary').parents('li:first'));
Added lines 96-107:
!! Move the 'Jobs Pending Release' link above the 'Transfers' link
[@
<script type="text/javascript">
 $(function() {
  $('#linkUserReleaseJobs').parents('li:first')
                          .remove()
                          .insertBefore($('#linkUserTransfer').parents('li:first'));
  });
</script>
@]

Changed line 109 from:
''Categories:'' [[Category.UserWebInterface|+]], [[Category.UserInterfaceCustomization|+]]
to:
''Categories:'' [[Category.UserWebInterface|+]], [[Category.UserInterfaceCustomization|+]]
Changed lines 5-7 from:
The snippets below are best placed in the @@footer.inc@@ file for user web tools customization.  See the article [[TailoredWebTools | +]] for more details.

to:
The snippets below are best placed in the @@footer2.inc@@ file for user web tools customization.  See the article [[TailoredWebTools | +]] for more details.

Changed lines 9-10 from:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header.inc@@ file).
to:
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header2.inc@@ file).
Changed line 85 from:
   var balance = $('table.userDataTable tbody tr:eq(1) td').text().substring(2);
to:
   var balance = $('table.userDataTable tbody tr:eq(1) td').text().replace(/[^\d\.]/g, "");
Changed line 14 from:
   $('div#logged-in-as').remove().insertAfter('#header-logo');
to:
   $('#logged-in-as').remove().insertAfter('#header-logo');
Changed line 23 from:
   $('div#nav ul').append('<li><a href="/help">Help</a></li>');
to:
   $('#nav ul').append('<li><a href="/help">Help</a></li>');
Changed line 32 from:
   $('a#linkUserTopUpCards').text('Activate Card');
to:
   $('#linkUserTopUpCards').text('Activate Card');
Changed lines 41-42 from:
   if ($('div#main h1').text() == 'Transfers') {
      $('div#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
to:
   if ($('#main h1').text() == 'Transfers') {
      $('#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
Changed line 65 from:
   if ($('div#main h1:eq(0)').text() == 'Summary') {
to:
   if ($('#main h1:eq(0)').text() == 'Summary') {
Changed lines 71-72 from:
     $('div#main h1:eq(1)').next().hide();
      $('div#main h1:eq(1)').hide();
to:
     $('#main h1:eq(1)').next().hide();
      $('#main h1:eq(1)').hide();
Changed lines 96-97 from:
[[Category.UserInterfaceCustomization|+]]
to:
----
''Categories:'' [[Category.UserWebInterface|+]],
[[Category.UserInterfaceCustomization|+]]
Added lines 95-96:

[[Category.UserInterfaceCustomization|+]]
Added lines 1-94:
(:title Example JavaScript For Customization of the User Web Tools Interface:)

The following are example JavaScript snippets that can be used to customize the [[WebTools | user web tools]] interface.  Functions from the JavaScript library [[http://docs.jquery.com/ | JQuery]] are used in many of the examples below.  Documentation on the JQuery site may assist with additional customization.

The snippets below are best placed in the @@footer.inc@@ file for user web tools customization.  See the article [[TailoredWebTools | +]] for more details.


!! Moving logged-in-as into the header
Moves the section that shows the currently logged in user from the footer to the header.  This example will place the 'logged in as' div element after an element with the id 'header-logo' (this ID will not exist by default and must be created in a custom @@header.inc@@ file).

[@
<script type="text/javascript">
  $(function() {
    $('div#logged-in-as').remove().insertAfter('#header-logo');
  });
</script>
@]

!! Adding an extra navigation menu item
[@
<script type="text/javascript">
  $(function() {
    $('div#nav ul').append('<li><a href="/help">Help</a></li>');
  });
</script>
@]

!! Change the label of a navigation menu item
[@
<script type="text/javascript">
  $(function() {
    $('a#linkUserTopUpCards').text('Activate Card');
  });
</script>
@]

!! Adding text to a page
[@
<script type="text/javascript">
  $(function() {
    if ($('div#main h1').text() == 'Transfers') {
      $('div#main h1').after("<p>Enter the receiving user's login name in 'Transfer to user'.</p>");
    }
  });
</script>
@]

!! Hiding data table columns
[@
<script type="text/javascript">
  $(function() {
    $('th.accountNameColumnHeader').hide();
    $('td.accountNameColumnValue').hide();
    $('th.printerDisplayNameColumnHeader').hide();
    $('td.printerDisplayNameColumnValue').hide();
  });
</script>
@]

!! Removing user balance and the balance graph
[@
<script type="text/javascript">
  $(function() {
    // check that we're on the Summary page
    if ($('div#main h1:eq(0)').text() == 'Summary') {
      // hide the current balance display (blanks out the second row in the table)
      $('table.userDataTable tbody tr:eq(1) th').text("");
      $('table.userDataTable tbody tr:eq(1) td').text("");

      // remove the activity heading and balance graph (hides the second heading and following section on the page)
      $('div#main h1:eq(1)').next().hide();
      $('div#main h1:eq(1)').hide();
    }
  });
</script>
@]

!! Replacing 'Balance' with 'MB Remaining'
Changes the displayed balance on the Summary page into a displayed 'MB Remaining'.  Uses a specified cost per MB to perform the calculation.

[@
<script type="text/javascript">
  $(function() {
    var costPerMB = 0.20;
    var balance = $('table.userDataTable tbody tr:eq(1) td').text().substring(2);
    var mb = balance / costPerMB;

    // change heading
    $('table.userDataTable tbody tr:eq(1) th').text("MB Remaining");
    // change value
    $('table.userDataTable tbody tr:eq(1) td').text(mb + " MB");
  });
</script>
@]

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on August 25, 2017, at 06:42 PM
Printable View   |   Article History   |   Edit Article