// ==UserScript==
// @name         Resizable Fullscreen Editor for Moodle Messenger (mSizeFix)
// @namespace    https://zhaw.ch
// @version      0.97.2
// @description  Ermöglicht ein grösseres Nachrichtenfeld im Moodle Messenger
// @author       Michael Rüegg <rugm@zhaw.ch>
// @homepageURL  https://moodle.zhaw.ch/course/view.php?id=2766
// @updateURL    https://moodle.zhaw.ch/mod/resource/view.php?id=116855
// @downloadURL  https://moodle.zhaw.ch/mod/resource/view.php?id=116855

// @include      https://moodle.zhaw.ch/*
// @match        https://*.zhaw.ch/message/index.php
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js




// ==/UserScript==

/* this is a wrapper around the fseditor4moodle script which implements fseditor on moodle messenger
 * @details fseditor4moodle in sourcecode @ https://moodle.zhaw.ch/mod/resource/view.php?id=116854
 * fseditor: https://github.com/burakson/fseditor
 */

var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');

// check if jquery is already loaded
if (typeof jQuery == 'undefined' ) {
	script.type = 'text/javascript';
	script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js";
	head.appendChild(script);
//	console.log( 'jquery needed');
}

	
// declare that we are running from userscript
script = document.createElement('script');
	script.type = 'text/javascript';
    script.text = 'var userscript = true;';
	head.appendChild(script);

// add mSizeFix
script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = "https://moodle.zhaw.ch/mod/resource/view.php?id=116854";
	head.appendChild(script);