-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added javascript file autoupdates.js to automate references and made…
… changes to include file field
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function handleFileSelect() { | ||
const fileInput = document.querySelector('[name="inputRISFile"]'); | ||
const textInput = document.querySelector('[name="title"]'); | ||
|
||
if (fileInput.files.length > 0) { | ||
const file = fileInput.files[0]; | ||
const reader = new FileReader(); | ||
|
||
reader.onload = function (event) { | ||
const fileContent = event.target.result; | ||
const lines = fileContent.split('\n'); // Split content into lines | ||
|
||
// Search for lines starting with "T1 -" or "TI -" | ||
const relevantLines = lines.filter(line => | ||
line.trim().startsWith("TI -") || line.trim().startsWith("T1 -") | ||
); | ||
|
||
// Extract the text after "T1 -" or "T1 -" | ||
const extractedText = relevantLines.map(line => | ||
line.trim().replace(/^(T1|TI) -/, "") | ||
).join("\n"); | ||
|
||
// Set the extracted text to textInput.value | ||
textInput.value = extractedText; | ||
}; | ||
|
||
reader.readAsText(file); // Read the file as text | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters