1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-12-22 16:08:09 +00:00

fixed task url detection

This commit is contained in:
Patrizio Bekerle 2017-06-15 11:17:52 +02:00
parent cb0da43ff5
commit f83dc7d00e
No known key found for this signature in database
GPG key ID: 2E9FFD770DABE838
2 changed files with 3 additions and 3 deletions

View file

@ -3,7 +3,7 @@
"identifier": "note-from-bitrix-task", "identifier": "note-from-bitrix-task",
"script": "note-from-bitrix-task.qml", "script": "note-from-bitrix-task.qml",
"authors": ["@pbek"], "authors": ["@pbek"],
"version": "0.0.1", "version": "0.0.2",
"minAppVersion": "17.05.6", "minAppVersion": "17.05.6",
"description" : "This script creates a menu item and a button that parses the text that was copied from a task webpage of the webservice <a href='https://www.bitrix24.com/'>Bitrix24</a> and creates a new note with a headline, the link to the task and the description." "description" : "This script creates a menu item and a button that parses the text that was copied from a task webpage of the webservice <a href='https://www.bitrix24.com/'>Bitrix24</a> and creates a new note with a headline, the link to the task and the description."
} }

View file

@ -1,5 +1,5 @@
import QtQml 2.0 import QtQml 2.0
import com.qownnotes.noteapi 1.0 import QOwnNotesTypes 1.0
/** /**
* This script creates a menu item and a button that parses the text that was copied * This script creates a menu item and a button that parses the text that was copied
@ -63,7 +63,7 @@ QtObject {
description = description.replace(/<br.*?>/gim, "\n").replace(/<.+?>/gim, ""); description = description.replace(/<br.*?>/gim, "\n").replace(/<.+?>/gim, "");
// var urlRegExp = /<form name="COMMENTS_.+?".*? action="(.+?)" method/im; // var urlRegExp = /<form name="COMMENTS_.+?".*? action="(.+?)" method/im;
var urlRegExp = /<a href="(.+?)[\?#].*?" class="main-buttons-item-link"/im; var urlRegExp = /<a href="(.+?\d+\/tasks\/task\/view\/d+\/)[\?#].*?" class="main-buttons-item-link"/im;
var urlMatch = urlRegExp.exec(html); var urlMatch = urlRegExp.exec(html);
var url = urlMatch !== null ? urlMatch[1] : ""; var url = urlMatch !== null ? urlMatch[1] : "";