sync
This commit is contained in:
72
Site/fic/js/active-line.js
Normal file
72
Site/fic/js/active-line.js
Normal file
@ -0,0 +1,72 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
|
||||
(function (mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function (CodeMirror) {
|
||||
"use strict";
|
||||
var WRAP_CLASS = "CodeMirror-activeline";
|
||||
var BACK_CLASS = "CodeMirror-activeline-background";
|
||||
var GUTT_CLASS = "CodeMirror-activeline-gutter";
|
||||
|
||||
CodeMirror.defineOption("styleActiveLine", false, function (cm, val, old) {
|
||||
var prev = old == CodeMirror.Init ? false : old;
|
||||
if (val == prev) return
|
||||
if (prev) {
|
||||
cm.off("beforeSelectionChange", selectionChange);
|
||||
clearActiveLines(cm);
|
||||
delete cm.state.activeLines;
|
||||
}
|
||||
if (val) {
|
||||
cm.state.activeLines = [];
|
||||
updateActiveLines(cm, cm.listSelections());
|
||||
cm.on("beforeSelectionChange", selectionChange);
|
||||
}
|
||||
});
|
||||
|
||||
function clearActiveLines(cm) {
|
||||
for (var i = 0; i < cm.state.activeLines.length; i++) {
|
||||
cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
|
||||
cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
|
||||
cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
function sameArray(a, b) {
|
||||
if (a.length != b.length) return false;
|
||||
for (var i = 0; i < a.length; i++)
|
||||
if (a[i] != b[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function updateActiveLines(cm, ranges) {
|
||||
var active = [];
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var range = ranges[i];
|
||||
var option = cm.getOption("styleActiveLine");
|
||||
if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
|
||||
continue
|
||||
var line = cm.getLineHandleVisualStart(range.head.line);
|
||||
if (active[active.length - 1] != line) active.push(line);
|
||||
}
|
||||
if (sameArray(cm.state.activeLines, active)) return;
|
||||
cm.operation(function () {
|
||||
clearActiveLines(cm);
|
||||
for (var i = 0; i < active.length; i++) {
|
||||
cm.addLineClass(active[i], "wrap", WRAP_CLASS);
|
||||
cm.addLineClass(active[i], "background", BACK_CLASS);
|
||||
cm.addLineClass(active[i], "gutter", GUTT_CLASS);
|
||||
}
|
||||
cm.state.activeLines = active;
|
||||
});
|
||||
}
|
||||
|
||||
function selectionChange(cm, sel) {
|
||||
updateActiveLines(cm, sel.ranges);
|
||||
}
|
||||
});
|
7645
Site/fic/js/codemirror.min.js
vendored
Normal file
7645
Site/fic/js/codemirror.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -651,6 +651,13 @@ $.privSet = function (key, val) {
|
||||
});
|
||||
}
|
||||
};
|
||||
$.getParentDomForChart = function () {
|
||||
return typeof isLocalForm === 'undefined' || !isLocalForm ? $(window.parent.document.body) : $(window.document.body);
|
||||
}
|
||||
$.getParentParamForChart = function () {
|
||||
return typeof isLocalForm === 'undefined' || !isLocalForm ? window.parent : window;
|
||||
}
|
||||
|
||||
|
||||
function Guid() {
|
||||
'use strict';
|
||||
@ -1367,6 +1374,20 @@ if (typeof _utility !== 'object') {
|
||||
}
|
||||
|
||||
var languageDoc = undefined;
|
||||
|
||||
function loadJsonFromServer(path) {//path 是json文件的地址
|
||||
var result = null;
|
||||
$.ajax({
|
||||
url: path,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
result = data;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
function loadXmlFile(xmlFile)//xmlFile 是xml文件的地址
|
||||
{
|
||||
var xmlDom = null;
|
||||
@ -1409,9 +1430,7 @@ if (typeof _utility !== 'object') {
|
||||
|
||||
function GetLanguageByKey(key, defaultValue) {
|
||||
var languageDir = _utility.currentLang;
|
||||
if (languageDir === "zh-cn") {
|
||||
languageDir = "zh-chs";
|
||||
}
|
||||
|
||||
if (languageDoc == undefined) {
|
||||
var sp;
|
||||
if (typeof _utility.rootPath === 'string') {
|
||||
@ -1421,7 +1440,7 @@ if (typeof _utility !== 'object') {
|
||||
} else {
|
||||
sp = '';
|
||||
}
|
||||
languageDoc = loadXmlFile(sp + "Languages\\" + languageDir + "\\textres.xml");
|
||||
languageDoc = loadJsonFromServer(sp + "Languages\\FIC\\" + languageDir + ".json");
|
||||
if (languageDoc == null) {
|
||||
if (_utility.currentLang.indexOf('en') >= 0) {
|
||||
languageDir = "en-us";
|
||||
@ -1430,22 +1449,18 @@ if (typeof _utility !== 'object') {
|
||||
} else {
|
||||
languageDir = "en-us";
|
||||
}
|
||||
languageDoc = loadXmlFile(sp + "Languages\\" + languageDir + "\\textres.xml");
|
||||
languageDoc = loadJsonFromServer(sp + "Languages\\FIC\\" + languageDir + ".json");
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (languageDoc) {
|
||||
key = key.toUpperCase();
|
||||
// IE下找不到tag会抛出Error,2017/6/21
|
||||
var val = languageDoc.getElementsByTagName(key);
|
||||
if (val && val.length > 0) {
|
||||
// IE下取tag为''的元素时会返回所有element
|
||||
if (val.length > 10) {
|
||||
return defaultValue;
|
||||
}
|
||||
return val[0].textContent || val[0].text;
|
||||
try {
|
||||
if (languageDoc && languageDoc.Values) {
|
||||
key = key.toUpperCase();
|
||||
var val = languageDoc.Values[key];
|
||||
if (val)
|
||||
return val;
|
||||
}
|
||||
}
|
||||
} catch (e) { }
|
||||
} catch (e) { }
|
||||
return defaultValue;
|
||||
}
|
||||
@ -2052,6 +2067,13 @@ if (typeof _utility !== 'object') {
|
||||
return (date.getTime() * 10000) + 621355968000000000;
|
||||
};
|
||||
|
||||
_utility.NeedModifyUI = function () {
|
||||
if (_utility.currentLang.indexOf("fr") >= 0 || _utility.currentLang.indexOf("pt") >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 格式化日期
|
||||
_utility.formatDate = function (date) {
|
||||
return date.toLocaleString();
|
||||
@ -3014,7 +3036,7 @@ $(function () {
|
||||
|
||||
var mainframe = $('#MainContent');
|
||||
if (mainframe.length > 0) {
|
||||
mainframe.load(function () {
|
||||
mainframe.on('load', function () {
|
||||
getiframedoc();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user