From b63d509cc16ccd2950eb9770440882c4e238d41e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 21 Mar 2021 16:52:29 +0100 Subject: Rename `main.js` to `main.js.in` Since this file has template variables, it's not a real executable JavaScript file. Add `.in` to the end to make it clear it needs to be built with Make. --- Makefile | 5 ++--- main.js | 44 -------------------------------------------- main.js.in | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 47 deletions(-) delete mode 100644 main.js create mode 100644 main.js.in diff --git a/Makefile b/Makefile index c557f76..fcc0355 100644 --- a/Makefile +++ b/Makefile @@ -48,14 +48,13 @@ build/key-event.js: lib/mousetrap/tests/libs/key-event.js | build build/peniquitous.js: peniquitous.js | build sed -e '/^(function/d' -e '$$d' $< > $@ -# TODO: Swap main file names -main.js.in: $(addprefix build/,$(IMPORTS_BASENAME)) +build/main.js: main.js.in $(addprefix build/,$(IMPORTS_BASENAME)) sed \ -e '/\$$KEY_EVENT/r build/key-event.js' \ -e '/\$$KEY_EVENT/d' \ -e '/\$$PENIQUITOUS/r build/peniquitous.js' \ -e '/\$$PENIQUITOUS/d' \ - main.js \ + $< \ > $@ peniquitous.user.js: main.js peniquitous.js userscript-header.txt diff --git a/main.js b/main.js deleted file mode 100644 index 1079a75..0000000 --- a/main.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2015, 2021 Teddy Wing -// -// This program 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. -// -// This program 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. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - -// var key_event = require('./lib/mousetrap/tests/libs/key-event.js'); -// var peniquitous = require('./peniquitous'); - -function key_event () { - $KEY_EVENT -} - -function peniquitous () { - $PENIQUITOUS -} - -(function() { - [ - key_event, - peniquitous - ].forEach(function(script) { - console.log('peniquitous', script); - var s = document.createElement('script'); - s.appendChild( - document.createTextNode('(' + script + ')();') - ); - // s.src = chrome.extension.getURL(file); - // s.onload = function() { - // this.parentNode.removeChild(this); - // }; - document.documentElement.appendChild(s); - }); -})(); diff --git a/main.js.in b/main.js.in new file mode 100644 index 0000000..1079a75 --- /dev/null +++ b/main.js.in @@ -0,0 +1,44 @@ +// Copyright (c) 2015, 2021 Teddy Wing +// +// This program 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. +// +// This program 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. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +// var key_event = require('./lib/mousetrap/tests/libs/key-event.js'); +// var peniquitous = require('./peniquitous'); + +function key_event () { + $KEY_EVENT +} + +function peniquitous () { + $PENIQUITOUS +} + +(function() { + [ + key_event, + peniquitous + ].forEach(function(script) { + console.log('peniquitous', script); + var s = document.createElement('script'); + s.appendChild( + document.createTextNode('(' + script + ')();') + ); + // s.src = chrome.extension.getURL(file); + // s.onload = function() { + // this.parentNode.removeChild(this); + // }; + document.documentElement.appendChild(s); + }); +})(); -- cgit v1.2.3