Created
January 7, 2015 15:03
-
-
Save jcchurch/7e6265ce1a77ab9ab604 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Set the editor mode | |
// @namespace | |
// @description Set the Plain Text Mode within Moddle | |
// @include http://courses.cs.westga.edu/* | |
// @version 0.1 | |
// @grant none | |
// ==/UserScript== | |
// | |
// This script will change the default Plain Text editor format | |
// to a specified option rather than "HTML format". | |
// | |
// The current setting in this script is for Markdown format. | |
// | |
// 1: HTML format | |
// 2: Moodle auto-format | |
// 3: Plain text format | |
// 4: Markdown format | |
// | |
// Written 20150105 | |
var desiredTextFormat = "4"; | |
function setSelectedIndex(selectionBoxId, value) { | |
selectionBox = document.getElementById(selectionBoxId); | |
if (selectionBox != null) { | |
for (var i = 0; i < selectionBox.options.length; i++ ) { | |
if (selectionBox.options[i].value == value) { | |
selectionBox.options[i].selected = true; | |
return; | |
} | |
} | |
} | |
} | |
window.addEventListener("load", function(e) { | |
setSelectedIndex("menusummary_editorformat", desiredTextFormat); | |
setSelectedIndex("menuintroeditorformat", desiredTextFormat); | |
setSelectedIndex("menupageformat", desiredTextFormat); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment