Skip to content

Latest commit

 

History

History
243 lines (161 loc) · 9.44 KB

README.md

File metadata and controls

243 lines (161 loc) · 9.44 KB

Monkey Scripts

This is a set of user scripts for the Tampermonkey web browser plugin.

⚠️ If you are new to the browser user scripts then read the Userscript Beginners HOWTO document first, at least the What are the risks? section.

Installation

Browser Plugin

  • At first you need to install the plugin into your browser. Go to the https://tampermonkey.net page, select your browser and install it.

  • To install the user script simply click the ⬇️ install link below and confirm the installation in Tampermonkey.

Bookmarklet

If you do not want to install any 3rd party plugin into your browser you can use the bookmarklet feature.

But using bookmarklet has some disadvantages:

  • The bookmarklet must be started manually on the page
  • The scripts code cannot be updated automatically

Installing a Bookmarklet

Bookmarklet is actually a page book mark but contains a Javascript code instead ofthe usual URL.

To create a bookmarklet create a new book mark in the browser and use the javascript: prefix and paste the *.user.js file content. You can skip the useless comment at the beginning but you have to include also the (function() {...})(); wrapper around the code body.

Using Bookmarklets

  • Open the page for which you want to run the bookmarklet
  • Click the bookmarklet book mark to start the script (the browser will use the current page, bookmarklets do not change the displayed page as the usual bookmarks)
  • This works in Chrome and Firefox but might not be supported by all browsers

Updating Bookmarklets

As already mentioned, the bookmarklets must be updated manually, simply select to edit the book mark and replace the old content with the new code.

Links

  • The Greasemonkey Hacks book contains several examples and good tips for writing you own scripts
  • https://openuserjs.org/ contains a lot of community scripts (but be careful, keep in mind that those scripts have access to your cookies, stored passwords etc... so they can easily steal your passwords or other sensitive data!)

Available User Scripts

Note: All scripts have been tested in the Chrome browser but should hopefully work also in the other browsers. But your mileage might vary...

Bugzilla

Here are some scripts usable for the (open)SUSE Bugzilla bug tracking system.

Bugzilla Redirection

⬇️ [Install]

The (open)SUSE Bugzilla can be accessed using several URLs: https://bugzilla.suse.com or https://bugzilla.opensuse.org or https://bugzilla.novell.com.

Each domain requires separate authentication so it is quite annoying if you click a link in an email or IRC chat and you get the "Access Denied" pages then you have to login again although you are already logged in in a different Bugzilla domain. Also the Novell domain uses a different branding so it would be nice to always stick with the same UI.

This script always redirects you to the bugzilla.suse.com pages automatically without need to rewrite the URL manually.

Note: The script runs as soon as possible, usually the "Access Denied" page is not displayed and bugzilla.suse.com loading starts immediately.

Relative Time

⬇️ [Install]

Bugzilla displays the time stamps for the comments but it is hard to get a quick overview how long ago the comments were added. To make reading the time stamps easier you can add relative time like "2 hours ago" or "5 months ago" next to the standard time stamps.

monkey_bugzilla_relative_time

Note: The script expects either the local time or the UTC time. If you use a different time zone then the script will not work correctly. You can change the displayed time zone in the bugzilla settings.

My Comments

⬇️ [Install]

If you are reading a bug with a lot of comments it would nice to spot your own comments quickly so you can see when and what have you already commented. This script adds a blue background to all your comments so you can find them quickly when scrolling up and down. The private comments have an orange background.

monkey_bugzilla_my_comments

Converting Bugzilla / FATE Numbers to Links

⬇️ [Install]

This scripts converts Bugzilla and FATE numbers into clickable links. This makes finding the details and the relevant information much easier.

The links created by the script have dashed underline style to make them different than the usual links.

screenshot_bugzilla_link

Trello Integration

⬇️ [Install]

This script integrates the information from Trello cards directly to SUSE Bugzilla. You can see the relevant Trello cards directly in the bug overview at the top.

The script searches the YaST Trello boards for the current bug number and additionally scans the bug comments and the URL field for the Trello card links. It displays the card title, the board and list name and the persons assigned to that card. (Hint: see the tooltip if the real name.)

bugzilla_trello

If there is no card found then a button for creating a new Trello card is displayed.

bugzilla_trello_add

After clicking it a new card is created, the URL is added to the bug, the assignee is changed from yast2-maintainers to yast-internal, the status is changed from NEW to CONFIRMED and the bug is submitted.

This basically implementes the functionality of Martin Vidner's ytrello directly in browser.

Before start using it, the Trello Developer API Key must be already generated. If you do not have it yet, got to https://trello.com/app-key and follow the instructions given there. Otherwise, the Error: Trello connection failed message will be displayed.

In addition, at first, you have to do Trello authorization to get the Trello application token. There is displayed a link to do that, just make sure the popup windows are not blocked by the browser. You can safely enable them for the Bugzilla URLs.


⚠️ This script cannot work as a bookmarklet as it uses some additional functionality provided by the Tampermonkey plugin. Browsers would normally block the Trello requests because they break the same origin policy.


Jenkins

Create Submit Requests Links

⬇️ [Install]

Converts the created request id [number] text into a clickable link which points to the created submit request. The script takes the API URL into account so the link correctly points to the internal or external build service depending on the API used.

(Note: it does not work when the text is added to the log when the job is running, you have to reload the page to restart the script.)

jenkins_sr_link

Enable/Disable YaST Autosubmission

⬇️ [Install]

This script adds Enable and Disable buttons into the YaST Jenkins pages. These buttons globally enable/disable YaST autosubmission to Factory (in the public Jenkins) or to the latest SLE (in the internal Jenkins) by enabling or disabling all YaST jobs for the master Git branch.

You need to be logged in to change the job statuses, see this internal wiki page for more details.

jenkins_enable_disable_buttons

Note: The current status of the jobs is read from the displayed table, it is recommended to reload the page before changing the jobs if the page has been loaded long time ago.


Trello

Better Aging

⬇️ [Install]

You can enable aging feature in Trello which changes the style of cards which have not been updated for long time. The feature is nice but the look of the old cards is a bit ugly, the cards are grayed and worse readable.

This script just adds a grey left border to the old cards and keeps the original style so the cards are better readable.

better_trello_aging