mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
www/codemirror/fhem_codemirror.js: Do not evaluate attr codemirrorParam if already loaded.
git-svn-id: https://svn.fhem.de/fhem/trunk@9706 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
941a4a78d7
commit
c9a347501e
@ -71,13 +71,13 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
function AddCodeMirror(e, cb) {
|
||||
if(cm_active && cm_loaded == cm_active)
|
||||
return cm_wait(e, cb);
|
||||
|
||||
var userAttr = scriptAttribute("fhem_codemirror.js");
|
||||
for(var a in userAttr)
|
||||
cm_attr[a] = userAttr[a];
|
||||
|
||||
if(cm_active && cm_loaded == cm_active)
|
||||
return cm_wait(e, cb);
|
||||
|
||||
cm_active++;
|
||||
loadLink("codemirror/codemirror.css");
|
||||
loadScript("codemirror/codemirror.js", function(){cm_loaded++;} );
|
||||
@ -97,7 +97,7 @@ function AddCodeMirror(e, cb) {
|
||||
}
|
||||
if (cm_attr.comment) {
|
||||
cm_active++; loadScript("codemirror/comment.js", function(){cm_loaded++;} );
|
||||
cm_attr.extraKeys['Ctrl-Q'] = function(cm) {
|
||||
cm_attr.extraKeys['Ctrl-Q'] = function(cm) {
|
||||
cm.toggleComment({ indent: false, lineComment: "#" });
|
||||
};
|
||||
}
|
||||
@ -137,8 +137,8 @@ function AddCodeMirror(e, cb) {
|
||||
}
|
||||
|
||||
function cm_wait(cm_editor, callback, recursions) {
|
||||
recursions = typeof recursions !== 'undefined' ? recursions : 0;
|
||||
if(cm_loaded != cm_active) {
|
||||
recursions = typeof recursions !== 'undefined' ? recursions : 0;
|
||||
if(recursions < 100) {
|
||||
recursions++;
|
||||
setTimeout(function(){ cm_wait(cm_editor, callback, recursions) }, 20);
|
||||
|
Loading…
Reference in New Issue
Block a user