Skip to content

Instantly share code, notes, and snippets.

@schoettl
Last active October 6, 2022 07:27
Show Gist options
  • Save schoettl/67f37a1430b68d4ce33e1ece05d43247 to your computer and use it in GitHub Desktop.
Save schoettl/67f37a1430b68d4ce33e1ece05d43247 to your computer and use it in GitHub Desktop.
Termine aus Tabelle einfach in HiOrg anlegen
// ==UserScript==
// @name New script - hiorg-server.de
// @namespace Violentmonkey Scripts
// @match https://www.hiorg-server.de/termin.php
// @grant none
// @version 1.0
// @author -
// @description 16.6.2021, 23:20:58
// ==/UserScript==
$(document).ready(function() {
var fillBtnClick = function() {
if (navigator.clipboard && navigator.clipboard.readText) {
navigator.clipboard.readText().then(text => {
if (!text) {
text = prompt('Hier per Copy & Paste eine Terminzeile aus der Tabelle eingeben.');
}
fillForm(text);
});
} else {
var text = prompt('Hier per Copy & Paste eine Terminzeile aus der Tabelle eingeben.');
fillForm(text);
}
}
var fillForm = function(rawData) {
var data = rawData.split('\t');
if (!rawData || data.length < 5) {
alert('Keine korrekten Eingabedaten. Abbruch.');
return;
}
$('input[name=verbez]').prop('value', data[0]);
$('#datum').prop('value', data[1]);
$('#zeit').prop('value', data[2]);
$('#verzeitbis').prop('value', data[3]);
$('input[name=treff]').prop('value', data[4]);
$('#cpy').prop('checked', true);
};
$('h1').first().append($('<button>Aus Excel-Zeile ausfüllen</button>').click(fillBtnClick));
});
@schoettl
Copy link
Author

Hey, freut mich, danke :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment