Remind About Saving CATS

Shows a red text on the working time entering page, so that people do not forget saving the data after releasing team.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Remind About Saving CATS
// @namespace    http://fprantl.opentext.com/
// @version      0.3
// @description  Shows a red text on the working time entering page, so that people do not forget saving the data after releasing team.
// @author       Ferdinand Prantl <[email protected]>
// @match        *://saperp.opentext.net/webgui*
// @grant        none
// ==/UserScript==

;(function() {
    'use strict'

    function ensureStyle (source) {
      if (source.querySelector('#fprantl-save-reminder-style')) {
        //console.log('CATS saving reminder style found.')
      } else {
        console.log('CATS detected, inserting the reminder style...')
        var style = source.createElement('style')
        style.id = 'fprantl-save-reminder-style'
        var content = [
          '#fprantl-save-reminder {',
          '  margin: 30px;',
          '  color: red;',
          '  animation: fprantl-save-reminder-blinker 3s linear infinite;',
          '}',
          '@keyframes fprantl-save-reminder-blinker {',
          '  50% { opacity: 0; }',
          '}'
        ].join('\n')
        style.appendChild(source.createTextNode(content))
        source.head.appendChild(style)
      }
    }

    function ensureWarning (source, container) {
      if (source.querySelector('#fprantl-save-reminder')) {
        //console.log('CATS saving reminder found.')
      } else {
        console.log('CATS detected, inserting the reminder warning...')
        var warning = source.createElement('div')
        warning.id = 'fprantl-save-reminder'
        warning.innerHTML = [
          '==============================<br>',
          '<span style="margin-left:20%">Klicke auf Save !!!</span>',
          '<br>=============================='
        ].join('\n')
        container = container.firstChild.firstChild.firstChild
        container.appendChild(warning)
      }
    }

    function ensureReminder () {
      var source = document
      var container = source.querySelector('#userarea-scrl')
      if (!container) {
        var frame = document.querySelector('#ITSFRAME1')
        if (frame) {
          source = frame.contentWindow.document
          container = source.querySelector('#userarea-scrl')
        }
      }
      if (container) {
        ensureStyle(source)
        ensureWarning(source, container)
      } else {
        //console.log('CATS not detected, leaving the page intact.')
      }
    }

    setInterval(ensureReminder, 3000)
  })();