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.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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)
  })();