| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846 |
- init();
- function init(callback, msg) {
- if (msg) {
- console.log("INIT:" + msg);
- } else
- console.log("INIT||||||")
- if (document.getElementById("editorgenerator")) {
- return
- }
- /**
- *
- * @param {String}
- * src
- * @param {Function}
- * callback
- */
- function loadScript(src, callback) {
- if (src) {
- var head = document.getElementsByTagName('body')[0];
- var script = document.createElement('script');
- script.id = src.substring(src.lastIndexOf("/") + 1, src.length).replace("\.", "_");
- if (document.getElementById(script.id)) {
- callback();
- return;
- }
- script.type = 'text/javascript';
- script.src = src;
- script.onload = script.onreadystatechange = function () {
- if ((!this.readyState || this.readyState === "loaded" || this.readyState === "complete") && callback) {
- callback();
- script.onload = script.onreadystatechange = null;
- }
- };
- head.appendChild(script);
- }
- };
- if ((typeof $) + "" == "undefined") {
- // 加载ueditor专用的jquery
- console.log("不存在JQUERY,动态加载");
- loadScript("/wd/js/ueditor/jquery.js", function () {
- init(callback, "加载完Jquery");
- });
- return;
- }
- if ((typeof UE) + "" == "undefined") {
- // 检测ueditor,如果没有
- console.log("加载UE");
- loadScript("/wd/js/ueditor/ueditor.config.js", function () {
- loadScript("/wd/js/ueditor/ueditor.parse.js", function () {
- loadScript("/wd/js/ueditor/ueditor.all.js", function () {
- init(callback, "加载完UE");
- })
- });
- });
- return;
- }
- if ($(window).on)
- $(window).on("load", function () {
- lload();
- });
- else if ($(window).bind) {
- $(window).bind("load", function () {
- lload();
- });
- } else if ($(window).live) {
- $(window).live("load", function () {
- lload();
- });
- } else {
- window.onload = lload();
- }
- function lload() {
- if ($(".ueditorItem").length > 0)
- $.each($(".ueditorItem"), function () {
- if ($(this).attr("loaded") == "true") {
- return false;
- }
- $(this).attr("loaded", "true")
- var name = $(this).val();
- var options = $(this).attr("options");
- initEditor(name, options);
- })
- }
- }
- function addEditor(name, options) {
- console.log("ADD" + name)
- var ueitem = document.createElement("input");
- ueitem.type = 'hidden';
- ueitem.className = 'ueditorItem';
- ueitem.value = name;
- if (options)
- ueitem.setAttribute("options", JSON.stringify(options));
- ueitem.setAttribute("loaded", "false");
- document.getElementsByTagName('body')[0].appendChild(ueitem);
- }
- var styleAttrs = ['width', 'height'];
- function initEditor(name, options) {
- options = options || {};
- if (typeof(options) == "string")
- try {
- options = JSON.parse(options);
- } catch (e) {
- console.log(e.message)
- options = {
- fullable: true
- };
- }
- /* 再去掉,去掉 ?wdApplication= -- 不支持多个应用,ssServ= 里可以写 ss.xxx。Lin
- options.wdApp = options.wdApp || getUrlVar("wdApplication");
- if (options.wdApp == null) {
- alert("没获取到参数wdApp");
- return;
- }
- */
- options.forbd != null && alert("“forbd”已摒弃,请使用“mode=change”");
- options.forbd != null && delete options["forbd"];
- if (options.edittemplate) {
- $("body").append("<input type='hidden' id='edittemplate' value='" + options.edittemplate + "'/>");
- }
- function getUrlVar(name) {
- var vars = [],
- hash;
- var hashes = window.location.href.slice(
- window.location.href.indexOf('?') + 1).split('&');
- for (var i = 0; i < hashes.length; i++) {
- hash = hashes[i].split('=');
- vars.push(hash[0]);
- vars[hash[0]] = hash[1];
- }
- return vars[name];
- };
- /**
- * 绑定对象名的模板
- * @param {Object} lbm
- * @param {Object} dxm
- * @param {Object} editorid
- */
- var txt = $("div#" + name + "Edit");
- // txt.css({
- // "width": '100%'
- // });
- $.each(styleAttrs, function () {
- var attrV = txt.attr(this);
- if (attrV != null) {
- txt.css(this, attrV);
- }
- });
- var player = $("#" + name + "Play");
- var pathinp = $("input[name='" + name + "wj']").eq(0);
- var path = pathinp.val();
- /* 再去掉,去掉 ?wdApplication= -- 不支持多个应用,ssServ= 里可以写 ss.xxx。Lin
- window.wdApp = "&wdApp=" + options.wdApp;
- */
- if (options.lbList) {
- $.each(options.lbList, function () {
- options[this.toString()] = $("select[name='" + this.toString() + "']").val();
- });
- }
- options.othertmpl = $("select[name='othertmpl']").val();
- if (options.othertmpl) {
- options["t_" + options.othertmpl.toString()] = options.othertmpl.toString();
- }
- var data = wd.c.getUeditorData(path, options);
- var f = $("<div class='UEDITORFIELD' style='background-color:#fff;'></div>");
- if (txt.length > 0 && (options.mode == "edit" || options.mode == "change")) {
- var textarea = document.createElement("textarea");
- textarea.name = txt.attr("id");
- textarea.value = txt.html();
- $.each(styleAttrs, function () {
- var attrV = txt.attr(this);
- if (attrV != null) {
- txt.css(this, attrV);
- }
- $(textarea).css(this, txt.css(this));
- });
- /// 增加,复制 <div id="msEdit" 的 dataset -- 内容 表增加 对象名、对象ID 字段 -- 对象的附件。Lin
- // data-ss-nr-obj-name="${ssObjName}" data-ss-nr-obj-id="${ssObjId}"
- for (let key in txt[0].dataset) {
- if (txt[0].dataset.hasOwnProperty(key)) {
- textarea.dataset[key] = txt[0].dataset[key];
- }
- }
- ///
- txt.after(textarea);
- txt.remove();
- txt = $(textarea);
- // 编辑器
- console.log(options)
- console.log("编辑器" + name + "Edit");
- txt.attr("id", name + "Edit");
- txt.before(f);
- f.append(txt);
- // txt[0].style.width = window.getComputedStyle(txt[0]).width;
- pathinp.val(data.path);
- (function (name, opts) {
- var editor = UE.getEditor(name + "Edit", opts);
- editor.ready(function () {
- this.options.imgWidth = data.imgWidth;
- this.options.imgHeight = data.imgHeight;
- /* 再去掉,去掉 ?wdApplication= -- 不支持多个应用,ssServ= 里可以写 ss.xxx。Lin
- editor.options.wdApp = opts.wdApp;
- */
- editor.addListener("keyup", function (type, event) {
- if (event.keyCode === 32) {
- var range_ = editor.window.getSelection().getRangeAt(0);
- window.top.range_ = range_;
- var sofs = range_.startOffset;
- range_.setStart(range_.startContainer, sofs - 1);
- range_.setEnd(range_.startContainer, sofs);
- if (sofs > 0 && range_.toString().charCodeAt() === 32) {
- console.log(range_)
- range_.startContainer.replaceData(sofs - 1, 1, String.fromCharCode(8194)); //8194是  也可能会用160( )
- }
- range_.setStart(range_.startContainer, sofs);
- range_.setEnd(range_.startContainer, sofs);
- range_.collapse(true)
- // 清除选定对象的所有光标对象
- window.getSelection().removeAllRanges()
- // 插入新的光标对象
- window.getSelection().addRange(range_)
- }
- });
- var callback_;
- if (opts.callback && typeof(opts.callback) == "string") {
- callback_ = eval(opts.callback);
- } else if (opts.callback && typeof(opts.callback) == "function") {
- callback_ = opts.callback;
- }
- if (opts.bindList) {
- console.log(opts.bindList)
- try {
- bindInput(opts.bindList, name + "Edit");
- } catch (e) {
- console.error(e.message)
- }
- }
- bindSelect(opts.lbList, opts.dxm, name + "Edit", function () {
- //切换模板之后的回调
- console.log(opts.bindList)
- if (opts.bindList) {
- for (k in opts.bindList) {
- var name = opts.bindList[k];
- var $inp = $("input[name='" + name + "']");
- if (growHeightList && growHeightList[name]) {
- $inp = $(growHeightList[name].getInputElement());
- }
- $inp.trigger("inputchange");
- }
- }
- });
- try {
- window[name + "_initWDEditor"] && window[name + "_initWDEditor"](this);
- } catch (e) {
- console.error("初始化WDEditorUI时发生异常");
- }
- this.setContent(data.content || txt.val());
- window.loadStyles && window.loadStyles(data.styles);
- callback_ && callback_.call(this);
- for (var i = 0; window.ueCallback != null && window.ueCallback[name] != null && i < window.ueCallback[name].length; i++) {
- window.ueCallback[name][i]();
- }
- // this.execCommand('cleardoc');
- // this.focus();
- // this.execCommand('inserthtml', data.content);
- });
- })(name, options)
- }
- if (player.length > 0 && options.mode == "play" || options.mode == "body") {
- console.log("播放器" + name + "Play");
- if (player.is("td")) {
- var id = player.attr("id");
- player.attr("id", "");
- player.append("<div id=" + id + "></div>")
- player = $("#" + id);
- }
- player.addClass("player").before(f);
- // f.before("<link rel='stylesheet' type='text/css' id='uefullscreenstyle' href='/wd/js/ueditor/uePlayer.css'>")
- f.append(player);
- //全屏、附件按钮
- player.css({
- overflow: "auto"
- });
- var t = data.content;
- if (options.textonly) {
- t = wd.display.removeHTMLTag(t);
- }
- player.html(t);
- if (typeof getGrowHeight != "undefined" && options.mode != "body"&&options["btn_opt_cms"]) { //有growHeight脚本,用growHeight初始化
- var cms_jlztm=options["btn_opt_cms"].jlztm?options["btn_opt_cms"].jlztm:options.cms_jlztm;
- var gh = wd.display.initGrowHighHtml(player.attr("id"), 300, options["btn_opt_cms"] ? {
- fj: {
- "key": options["btn_opt_cms"].key,
- "value": options["btn_opt_cms"].value,
- "name": options["btn_opt_cms"].name,
- "jlztm": cms_jlztm
- }
- }
- : {});
- if (gh.cmsBtn && options["btn_opt_cms"]) {
- console.log(gh.cmsBtn);
- bindCMS([gh.cmsBtn], options["btn_opt_cms"].value, cms_jlztm, options.cms_play, options.cms_play_atom);
- }
- } else { //ueditor原来的脚本
- if (options && options.toolbars) {
- for (var i = 0; i < options.toolbars[0].length; i++) {
- var o = options.toolbars[0][i];
- if (typeof(o) == "string" && o == "fullscreen") {
- // if(options && (options.fullable != "false" && options.fullable != false) && wd.display.removeHTMLTag(data.content) != '') {
- // f.addClass("fullable");
- f.prepend("<input type='button' class='list-button fullButton btn' value='全屏' onclick='ueFul(this)' />");
- } else if (typeof(o) == "string" && o == "cms") {
- var btn = $("<input type='button' class='list-button' style='float:right;margin:5px;' id='" + options["btn_opt_cms"].key + "Play' value='附件' />");
- f.prepend(btn);
- // f.append("<input type='hidden' name='fjid' value='" + options["btn_opt_cms"].value + "'/>")
- var cms_jlztm=options["btn_opt_cms"].jlztm?options["btn_opt_cms"].jlztm:options.cms_jlztm;
- bindCMS(btn, options["btn_opt_cms"].value, cms_jlztm, options.cms_play, options.cms_play_atom);
- }
- }
- }
- }
- // $p=$("input[name='ueditorpath']");
- // $("input[name='"+$p.val()+"']").remove();
- // $p.remove();
- if (!options.callback) {}
- else
- if (typeof(options.callback) == "string") {
- callback_ = eval(options.callback);
- callback_.call(this);
- } else
- if (typeof(options.callback) == 'function') {
- options.callback.call(this);
- }
- };
- }
- function bindCMS(btn, nrid, jlztm, cms_play, cms_play_atom) {
- function fjPlayClick() {
- if (nrid == null || nrid.length == 0) {
- $.ajax({
- type: 'GET',
- url: '/service?ssServ=makeAttCms', // =getNewNridAndUpdateNrmc。Lin
- data: {
- name: 'fj'
- },
- async: false,
- success: function (data) {
- nrid = data;
- },
- });
- }
- var user = ''
- var Nrid = 'T-' + nrid;
- var str = '&nrid=';
- str += Nrid;
- if (jlztm != undefined && jlztm != "") {
- if (cms_play.indexOf("&jlztm=") == -1){
- str += '&jlztm=' + jlztm;
- }else{
- var ss =cms_play.split("&jlztm=")
- if(ss[1]!=jlztm){
- cms_play=cms_play.replace("&jlztm="+ss[1],'&jlztm=' + jlztm);
- }
- }
- }
- if (user != undefined && user != "") {
- str += '&user=';
- str += user;
- }
- var nrjslbm;
- $.ajax({
- type: 'POST',
- url: '/service?ssServ=wrNrjslbm', // =getNrjslbm,。Lin
- data: {
- nrid: nrid
- },
- async: false,
- success: function (data) {
- nrjslbm = data;
- },
- });
- if (nrjslbm == 150 || nrjslbm == '150') {
- wd.display.showComponent({
- show: ['wdDialog'],
- hide: [],
- url: cms_play + str,
- dest: 'cmsPlay', // : 'nr_bf',。Lin
- title: '播放',
- width: 900,
- high: 664,
- wdDialogId: 44011763,
- form: ''
- });
- } else {
- wd.display.showComponent({
- show: ['wdDialog'],
- hide: [],
- url: cms_play_atom + str + '&nrjslbm=' + nrjslbm,
- dest: 'ccmsPlay', // : 'yznr_bfq',。Lin
- title: '播放',
- width: 900,
- high: 664,
- wdDialogId: 44011763,
- form: ''
- });
- }
- }
- (function () {
- var play = btn[0];
- if (play != null) {
- if (nrid == null || nrid.length == 0) {
- play.className = 'disabled-button';
- play.setAttribute('disabled', 'disabled');
- play.style.display = "none";
- } else {
- var flag = null;
- var Nrid = 'T-' + nrid;
- $.ajax({
- type: 'GET',
- url: '/service?ssServ=wrHasCcms', // =checkNrHasChildren'。Lin
- data: {
- 'nrid': Nrid // 'id':。统一为 "nrid" = CmsC.REQ_cmsId。Lin
- },
- dataType: 'json',
- async: false,
- success: function (data) {
- /// 增加,增加错误处理 -- 统一 Ajax 返回标准 -- .ssCode、.ssMsg、.ssData。Lin
- if (data.ssCode != 0) {
- alert(data.ssMsg);
- return;
- }
- ///
- flag = data.result;
- }
- });
- if (flag) {
- play.cms_jlztm = jlztm;
- if (play.addEventListener) {
- play.addEventListener('click', fjPlayClick, false);
- } else if (play.attachEvent) {
- play.attachEvent('onclick', fjPlayClick);
- } else {
- play['onclick'] = fjPlayClick;
- }
- } else {
- console.info(flag);
- play.setAttribute('disabled', 'disabled');
- play.style.display = "none";
- }
- }
- }
- })();
- }
- function bindSelect(lbList, dxm, editorid, callback) {
- if ($("#oldlbl").length < 1) {
- $("body").append("<input type='hidden' id='oldlbl'/>")
- }
- var olb = [];
- if (lbList)
- $.each(lbList, function () {
- var name = this.toString();
- olb.push("old" + name);
- var $inp = $("[name='" + name + "']");
- if ($inp.is("select") || (wd.edit.objectPicker && wd.edit.objectPicker.isObjectPicker($inp[0]))) { //下拉菜单或者objectpicker才能切换模板
- $inp.attr("id", name).after("<input type='hidden' id='old" + name + "' value='0'/>");
- $inp.bind("change", function () {
- var old = $("#old" + this.name),
- val = $(this).val(),
- content = UE.getEditor(editorid).getContent(),
- olblist = eval($("#oldlbl").val());
- if (content.trim() == "") {
- lbList.push("otherTmpl");
- loadUEDTempLate(dxm, lbList, editorid, callback);
- old.val(val);
- } else {
- if ($("#edittemplate").length > 0) {
- // console.log("EQUALS+")
- lbList.push("otherTmpl");
- loadUEDTempLate(dxm, lbList, editorid, callback);
- old.val($(this).val());
- }
- }
- });
- // $("select[name='" + lbm + "']").attr("id", lbm).after("<input type='hidden' id='old" + lbm + "' value='0'/>");
- // $("select[name='" + lbm + "']") /*.unbind("change")*/.bind("change", function () {
- // var old = $("#old" + lbm);
- // var content = UE.getEditor(editorid).getContentTxt();
- // var olblist = eval($("#oldlbl").val());
- // if (content.trim() == "") {
- // lbList.push("otherTmpl");
- // loadUEDTempLate(dxm, lbList, editorid, callback);
- // old.val($(this).val());
- // } else {
- // // var oldtmp = loadUEDTempLate(dxm, olblist).content;
- // // console.log("CONTENT:" + content);
- // // console.log("TEMPLATE:" + wd.display.removeHTMLTag(oldtmp));
- // if ($("#edittemplate").length > 0 || /*wd.display.removeHTMLTag(content) == wd.display.removeHTMLTag(oldtmp) || */(confirm("您切换了类别,是否切换对应的模板\n(切换模板后可以按编辑器上的“撤销”按钮\n或键盘上“Ctrl” + “z”进行撤销)"))) {
- // // console.log("EQUALS+")
- // lbList.push("otherTmpl");
- // loadUEDTempLate(dxm, lbList, editorid, callback);
- // old.val($(this).val());
- // }
- // }
- // });
- }
- });
- $("#oldlbl").val(JSON.stringify(olb));
- }
- function bindInput(inputList, editorid) {
- console.log(inputList)
- function bindInputChange(inputname, editorid) {
- var $inp = $("[name='" + inputname + "']");
- if (growHeightList && growHeightList[inputname]) {
- $inp = $(growHeightList[inputname].getInputElement());
- }
- if ($inp.length > 0) {
- $inp.bind("keyup keydown mouseup click change input propertychange change", function (event) {
- $(this).trigger("inputchange");
- });
- $inp.bind("inputchange", function (event) {
- var $this = $(this),
- val = $this.val();
- if ($this.is("select")) {
- val = $this.find("option:selected").text();
- } else if (wd.edit.objectPicker.isObjectPicker($this[0])) {
- val = wd.edit.objectPicker.getDisplayValue($this[0])
- }
- var target = $("#" + editorid).find(".edui-editor-iframeholder ").find("iframe").eq(0).contents().find("." + inputname);
- // console.log(a)
- if (val != "") {
- target.text(val);
- var e = UE.getEditor(editorid);
- e.setContent('', true);
- }
- });
- if (inputname.length >= 2 && inputname.substr(inputname.length - 2, inputname.length) == "sj") {
- //没有值的时候才赋值
- if ($inp.val() == '') {
- $inp.val(new Date().format("yyyy-MM-dd"));
- $inp.trigger("inputchange");
- }
- }
- $inp.trigger("inputchange");
- } else {
- console.log("没找到input:" + inputname);
- }
- }
- if (inputList)
- $.each(inputList, function (key, val) {
- console.log(key + ":" + val);
- bindInputChange(val, editorid);
- })
- }
- window.top.ueFul = function (obj) {
- //允许所有iframe全屏
- var arr = parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- arr = parent.parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- var element = $(obj).parent()[0];
- console.log(element);
- var fullscreenchange = function () {
- if (document.webkitFullscreenElement != null) {
- $(element).addClass("scrollbar");
- $(element).css("padding", "30px");
- $(element).css("box-sizing", "border-box");
- element.style.overflowY = "auto";
- element.style.overflowX = "hidden";
- element.style.width = "100%";
- element.style.height = "100%";
- element.style.zoom = 2;
- $(obj).hide();
- console.log("进入全屏函数");
- $('.list-button').css({
- 'display': 'none'
- });
- $('.player').append('<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="button-restore icon-restore" style="position: fixed;right: 10px;top: 10px;height:22px;width:22px;" onclick="exitFullscreen()" ></div></div></div>');
- } else {
- console.log("退出全屏函数");
- $(element).removeClass("scrollbar");
- $(element).css("padding", "0px");
- $(element).css("box-sizing", "border-box");
- element.style.height = 'auto';
- element.style.width = 'auto';
- element.style.zoom = 1;
- $(obj).show();
- //添加监听器,监听用户进入全屏和退出全屏操作
- element.removeEventListener("webkitfullscreenchange", fullscreenchange);
- element.removeEventListener("fullscreenchange", fullscreenchange);
- element.removeEventListener("mozfullscreenchange", fullscreenchange);
- element.removeEventListener("msfullscreenchange", fullscreenchange);
- $('.list-button').css({
- 'display': 'block'
- });
- $('.player #pageClose').remove();
- }
- }
- element.addEventListener("webkitfullscreenchange", fullscreenchange);
- element.addEventListener("fullscreenchange", fullscreenchange);
- element.addEventListener("mozfullscreenchange", fullscreenchange);
- element.addEventListener("msfullscreenchange", fullscreenchange);
- if (element.requestFullscreen) {
- element.requestFullscreen();
- } else if (element.msRequestFullscreen) {
- element.msRequestFullscreen();
- } else if (element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- } else if (element.webkitRequestFullScreen) {
- element.webkitRequestFullScreen();
- }
- }
- ueFul = function (obj) {
- //允许所有iframe全屏
- var arr = parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- arr = parent.parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- var element = $(obj).parent()[0];
- console.log(element);
- var fullscreenchange = function () {
- if (document.webkitFullscreenElement != null) {
- // $(element).addClass("scrollbar");
- $(element).css("padding", "30px");
- $(element).css("box-sizing", "border-box");
- element.style.overflowY = "auto";
- element.style.overflowX = "hidden";
- element.style.width = "100%";
- element.style.height = "100%";
- element.style.zoom = 2;
- $(obj).hide();
- console.log("进入全屏函数");
- $('.list-button').css({
- 'display': 'none'
- });
- $('.player').append('<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="button-restore icon-restore" style="position: fixed;right: 10px;top: 10px;height:22px;width:22px;" onclick="exitFullscreen()" ></div></div></div>');
- } else {
- console.log("退出全屏函数");
- $(element).removeClass("scrollbar");
- $(element).css("padding", "0px");
- $(element).css("box-sizing", "border-box");
- element.style.height = 'auto';
- element.style.width = 'auto';
- element.style.zoom = 1;
- $('#zwPlay').css('height', '88%'); //须知调样式
- $(obj).show();
- //添加监听器,监听用户进入全屏和退出全屏操作
- element.removeEventListener("webkitfullscreenchange", fullscreenchange);
- element.removeEventListener("fullscreenchange", fullscreenchange);
- element.removeEventListener("mozfullscreenchange", fullscreenchange);
- element.removeEventListener("msfullscreenchange", fullscreenchange);
- $('.list-button').css({
- 'display': 'block'
- });
- $('.player #pageClose').remove();
- }
- }
- element.addEventListener("webkitfullscreenchange", fullscreenchange);
- element.addEventListener("fullscreenchange", fullscreenchange);
- element.addEventListener("mozfullscreenchange", fullscreenchange);
- element.addEventListener("msfullscreenchange", fullscreenchange);
- if (element.requestFullscreen) {
- element.requestFullscreen();
- } else if (element.msRequestFullscreen) {
- element.msRequestFullscreen();
- } else if (element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- } else if (element.webkitRequestFullScreen) {
- element.webkitRequestFullScreen();
- }
- }
- // 退出全屏
- function exitFullscreen() {
- var elem = document;
- if (elem.webkitCancelFullScreen) {
- elem.webkitCancelFullScreen();
- } else if (elem.mozCancelFullScreen) {
- elem.mozCancelFullScreen();
- } else if (elem.cancelFullScreen) {
- elem.cancelFullScreen();
- } else if (elem.exitFullscreen) {
- elem.exitFullscreen();
- } else {
- alert('浏览器不支持全屏API或已被禁用,请按esc键退出');
- //浏览器不支持全屏API或已被禁用
- }
- }
- bodyFul = function (obj, hasAbstract) {
- //允许所有iframe全屏
- var arr = parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- arr = parent.parent.document.getElementsByTagName('IFRAME');
- for (var i = 0; i < arr.length; i++) {
- var iframeObj = arr[i];
- iframeObj.setAttribute("allowfullscreen", true);
- }
- var element = $(obj).parent()[0];
- console.log(element);
- var fullscreenchange = function () {
- if (document.webkitFullscreenElement != null) {
- $(element).addClass("scrollbar");
- $(element).css("padding", "30px");
- $(element).css("box-sizing", "border-box");
- element.style.overflowY = "auto";
- element.style.overflowX = "hidden";
- element.style.width = "100%";
- element.style.height = "100%";
- element.style.zoom = 2;
- //$(obj).hide();
- if (hasAbstract) {
- $(obj).show();
- }
- console.log("进入全屏函数");
- $('.list-button').css({
- 'display': 'none'
- });
- $('.player').append('<div id="pageClose" class=" dhtmlx_skin_dhx_skyblue"><div class="dhtmlx_window_active"><div class="button-restore icon-restore" style="position: fixed;right: 10px;top: 10px;height:22px;width:22px;" onclick="exitFullscreen()" ></div></div></div>');
- } else {
- console.log("退出全屏函数");
- $(element).removeClass("scrollbar");
- $(element).css("padding", "0px");
- $(element).css("box-sizing", "border-box");
- element.style.height = 'auto';
- element.style.width = 'auto';
- element.style.zoom = 1;
- //$(obj).show();
- //添加监听器,监听用户进入全屏和退出全屏操作
- element.removeEventListener("webkitfullscreenchange", fullscreenchange);
- element.removeEventListener("fullscreenchange", fullscreenchange);
- element.removeEventListener("mozfullscreenchange", fullscreenchange);
- element.removeEventListener("msfullscreenchange", fullscreenchange);
- if (hasAbstract) {
- $(obj).hide();
- }
- $('.list-button').css({
- 'display': 'block'
- });
- $('.player #pageClose').remove();
- }
- }
- element.addEventListener("webkitfullscreenchange", fullscreenchange);
- element.addEventListener("fullscreenchange", fullscreenchange);
- element.addEventListener("mozfullscreenchange", fullscreenchange);
- element.addEventListener("msfullscreenchange", fullscreenchange);
- if (element.requestFullscreen) {
- element.requestFullscreen();
- } else if (element.msRequestFullscreen) {
- element.msRequestFullscreen();
- } else if (element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- } else if (element.webkitRequestFullScreen) {
- element.webkitRequestFullScreen();
- }
- }
- function loadUEDTempLate(templateName, lbList, editorid, callback) {
- var ueopt = UE.getEditor(editorid, options).options;
- var options = {
- mode: ueopt.mode,
- dxm: ueopt.dxm
- };
- options.othertmpl = $("[name='othertmpl']").val();
- if (options.othertmpl) {
- options["t_" + options.othertmpl.toString()] = options.othertmpl.toString();
- }
- options.edittemplate = $("#edittemplate").length > 0 ? 1 : null;
- if (lbList)
- $.each(lbList, function () {
- options[this.toString()] = $("[name='" + this.toString() + "']").val();
- });
- options.template = templateName;
- /* 再去掉,去掉 ?wdApplication= -- 不支持多个应用,ssServ= 里可以写 ss.xxx。Lin
- options.wdApp = UE.getEditor(editorid).options.wdApp;
- */
- var result = wd.c.getUeditorData(null, options);
- if (UE) {
- if (editorid) {
- var edit = UE.getEditor(editorid, options).ready(function () {
- // this.execCommand("cleardoc");
- // this.execCommand("inserthtml", result.content);
- // this.setContent(result.content, false, true);
- this.setContent(result.content);
- this.options.imgWidth = result.imgWidth;
- this.options.imgHeight = result.imgHeight;
- window.loadStyles && window.loadStyles(result.styles);
- });
- }
- if (callback)
- callback();
- }
- if (options.edittemplate && editorid)
- $("#" + editorid.replace("Edit", "") + "wj").val(result.path);
- return result;
- }
|