JS code for the entire Rukovoditel (custom HTML)

Share your custom code, plugins and themes.
Post Reply
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

JS code for the entire Rukovoditel (custom HTML)

Post by Didou12 »

Hi everyone,

Here is some JS codes I use in the custom HTML.
Maybe it can help you. If you think my code can be improve, let me know here :)
If you have ideas to share, tell me too.
If my English is poor, just let me know too :)



- You can add this JS in Configuration, Custom HTML, Add code before tag </body>. You need to add code in a tag script "<script>CODE HERE</script>"
- Remember JS can be access with source of the page, so don't use confidential or privacy datas



  • If just one record on the listing (it works with table listing), redirect to it

Code: Select all

if (window.location.href.endsWith("/index.php?module=items/items&path=12")) { //if the url ends with; 12 is the entity ID
  var intervalCheck = setInterval(function() { //check but with a delay to make sure all records are loaded
    var numberRecord = $(".listing-table-tr").length;
    if (numberRecord === 2) {
      clearInterval(intervalCheck);
      window.location.href = $(".item_heading_link").attr("href");
    }
  }, 500); //500 milliseconds
}

  • To hide entity you don't want to show (like an entity you already have in a report, like Kanban) (with my tests it doesn't work with custom CSS) (edited on 2024-01-03)

Code: Select all

$('ul.sub-menu a.menu-itemsitems12').hide(); //12 is the entity ID and IF in a sub-menu, IF not delete "ul.sub-menu" part
For an entity you can use : itemsitems12 ; for an information page : extipagesview12 ; for a report : reportsview12 ; for a kanban : extkanbanview12
(where 12 is the ID)


  • To hide filter panel of all Kanbans

Code: Select all

$('.kanban-div').prev().hide();

  • To redirect the page of an entity you already have in a report, like Kanban

Code: Select all

if (window.location.href.endsWith("/index.php?module=items/items&path=12")) { //if the page is the entity ID 12
	window.location.href = "/index.php?module=ext/kanban/view&id=1"; //redirect to Kanban ID 1
}



I hope it can help you :)
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
Didou12
Posts: 487
Joined: 14 Jan 2023, 14:53
Name: Louis
Location: Montreal, Canada

Re: JS code for the entire Rukovoditel (custom HTML)

Post by Didou12 »

I edited :
To hide entity you don't want to show (like an entity you already have in a report, like Kanban) (with my tests it doesn't work with custom CSS) (edited on 2024-01-03)
Using Rukovoditel since 2022 --- v3.4 (with extension) in French on PHP 8.2
I keep the French translation up to date
I'm trying to help you (+10 years experience in html, css, php, sql, JS/jquery, python)
Post Reply