Skip to content

Commit

Permalink
Disabling all nashorn scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Jun 12, 2022
1 parent 0082bb1 commit 7fa6473
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 28 deletions.
16 changes: 4 additions & 12 deletions js/nashorn-announcements.js → js/core-announcements.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@
General Public License for more details.
*/

var inputEventTime = -1

Luwrain.addHook("luwrain.announcement", function(text, announcementClass, announcementSubclass){
var d = new java.util.Date();
if (inputEventTime >= 0 && d.getTime() - inputEventTime < 30000)
return;
Luwrain.addHook("luwrain.announcement", (text, announcementClass, announcementSubclass)=>{
/*
var listening = '' + Luwrain.prop.luwrain.area.listening + '';
if (listening === 'true')
return;
if (text.match("RT @[a-zA-Z0-9_]+: .*"))
text = text.substring(text.indexOf(":") + 1);
Luwrain.message.announcement(text);
});

Luwrain.addHook("luwrain.events.input", function(event){
var d = new java.util.Date();
inputEventTime = d.getTime();
*/
Luwrain.message(text);
});
22 changes: 22 additions & 0 deletions js/core-web-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Copyright 2019-2022 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
LUWRAIN is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
LUWRAIN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/

Luwrain.addHook("luwrain.web.search", (query)=>{
const q = query.trim();
return {title: q + " (Поиск в DuckDuckGo)", items: [{title: "kaka"}]};
});


24 changes: 8 additions & 16 deletions js/nashorn-web.js → js/core-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,17 @@
General Public License for more details.
*/

Luwrain.addHook("luwrain.url.open.default", function(url){
Luwrain.addHook("luwrain.url.open", (url)=>{
Luwrain.launchApp("reader", [url]);
});

/*
Luwrain.addCommand("url", function(){
var url = Luwrain.popups.simple("Открыть URL", "URL:", "");
if (url == null)
return;
Luwrain.openUrl(url);
});
*/

Luwrain.addHook("luwrain.web.open", function(query){
if (query.trim().toLowerCase().startsWith("http:https://") ||
query.trim().toLowerCase().startsWith("https://"))
{
Luwrain.openUrl(query.trim());
Luwrain.addHook("luwrain.web.open", (query)=>{
const q = query.trim();
if (q.toLowerCase().startsWith("http:https://") ||
q.toLowerCase().startsWith("https://")) {
Luwrain.log.debug("web", q + " true");
Luwrain.openUrl(q);
return true;
}
return null;
return false;
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7fa6473

Please sign in to comment.