123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524 |
- //#region UI区域
- //UI窗体区域
- Namespace.register("U.UI") //窗体的命名空间
- //选择框使用
- U.UI.RadioList = function (UDOD, UDE, UCB) {
- return new U.UI.RadioList.init(UDOD, UDE, UCB);
- }
- //#region 窗体
- /*
- Form窗体的使用
- 1、可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
- 2、也可以省略new的步骤,直接U.Alert(),出来的结果为多份。
- 3、多窗口模式调用方法,var e= U.UI.From (UDE); e.addExtendForm();
- 参数一:_UFE[add "name":"add"]
- 参数二:_UTT 存放大小变化的值
- 返回值:
- */
- /**
- * 可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
- *
- * @param {object} 窗体使用传参
- ----------min 是否允许最小化
- ----------max 是否允许最大化
- ----------id 窗体id
- ----------style 窗体的样式
- ----------content 窗体的内容
- ----------title 窗体的标题
- ----------hst 标题设置
- ----------cst 内容设置
- ---------__top__ 是否允许点击置顶
- * @return {object} 窗体实体
- */
- U.UI.Form = U.UI.From = function (UDE) {
- return new U.UI.Form.init(UDE).create();
- }
- /**
- * 可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
- *
- * @param {object} 窗体使用传参
- ----------min 是否允许最小化
- ----------max 是否允许最大化
- ----------id 窗体id
- ----------style 窗体的样式
- ----------content 窗体的内容
- ----------title 窗体的标题
- ----------hst 标题设置
- ----------bst 内容设置
- ----------draw 是否允许拉伸
- * @return {object} 窗体本身
- */
- U.UI.Form.init = function (UDE) { //初始化
- U.Ut.AddObj(this, UDE);
- return this;
- }
- U.UI.Form.et = {}; //所有窗体集合
- //窗体使用函数
- U.UI.Form.init.prototype = {
- et: U.UI.Form.et, //所有窗体集合
- //构建元素
- create: function () {
- var i, _USE, _UDOD, _UDTD, _UDSD, _UAE, _UTE = this,
- _UTI = this.title, //标题元素
- _UCT = this.content, //内容元素
- _UCE = [
- ["H", "up"],
- ["HL", "topRight"],
- ["HR", "topleft"],
- ["ML", "left"],
- ["MR", "right"],
- ["B", "down"],
- ["BL", "bottomLeft"],
- ["BR", "bottomRight"]
- ];
- if (this.id && this.et[this.id] && this.et[this.id].be.id == this.id) { //无需创建
- _UTE = this.et[this.id]; //获取当前窗体属性
- _UTE.be.style.cssText = "";
- (_UTE.body) && (_UTE.body.style.cssText = "");
- $(_UTE.be).addAttrArray({
- className: this.className ? this.className : "UD_SYF_S UD_SYKO", //css样式名"UD_SYF_S UD_SYKO"
- close: U.M.apply(_UTE, _UTE.shut),
- "__top__": this.top ? "false" : "", //是否允许点击置顶
- "__right__": this.right || "",
- usform: "true", //设置窗体属性
- "id": this.id || "", //绑定继承ID
- "style": this.style || {}
- });
- ($(_UTE.body).addAttrArray(this.bst));
- (_UTI && (_UTE.title = _UTI)) && (U.Ut.isString(_UTI) ? (_UTE.head.innerHTML = _UTI) : (_UTE.head.innerHTML = "", $(_UTE.head).append(_UTI))); //重新设置标题
- (_UCT && (_UTE.content = _UCT)) && (U.Ut.isString(_UCT) ? ((U.M.IsUrl(_UCT)) ? "" : _UTE.body.innerHTML = _UCT) : (($(_UCT).Parent() != _UTE.body) && (_UTE.body.innerText = "", $(_UTE.body).append(_UCT)))); //内容设置
- _UDOD = _UTE.be;
- }
- else { //创建窗体
- (this.be = _UDOD = $$("div", { //创建元素
- className: this.className ? this.className : "UD_SYF_S UD_SYKO", //css样式名"UD_SYF_S UD_SYKO"
- close: U.M.apply(this, this.shut),
- "__top__": this.top ? "false" : "", //是否允许点击置顶
- "__right__": this.right || "",
- usform: "true", //设置窗体属性
- "id": this.id || "", //绑定继承ID
- "style": this.style || {}
- })).onresize = U.M.apply(this, [[this.size]]); //设置元素变化事件
- (this.attr) && ($(this.be).addAttrArray(this.attr));
- if (this.title !== false) {
- this.head = _UDTD = $$("div", {
- className: "UD_SYF_ST",
- onmousedown: [[U.D.DragMouseDown, [_UDOD, null, this]]] //窗体拖动//鼠标事件按下发生
- }, _UDOD);
- //重载hst为headerStyle,更加语义化.
- (this.headerStyle) && ($(_UDTD).addAttrArray(this.headerStyle));
- (this.hst) && ($(_UDTD).addAttrArray(this.hst)); //给标题头部添加样式
- (_UTI != null) && ($(_UDTD).append(_UTI)); //添加头部
- } else if (this.draw !== false) {
- _UDOD.onmousedown = U.M.apply(_UDOD, [[U.D.DragMouseDown, [_UDOD]]]); //窗体拖动
- }
- if (this.content !== false) {//判断元素是否有bst,添加
- _UDTD = $$("div", {
- className: "UD_SYF_SC"
- }, _UDOD);
- this.body = _UDTD = $$("div", {
- usbody: "true",
- className: "UD_SYF_SCO"
- }, _UDTD);
- (this.bst) && ($(this.body).addAttrArray(this.bst));
- $(_UDTD).bind("scroll", U.M.apply(this, this.scroll)); //避免闭包耗费资源。
- //iframe的处理方式
- if (_UCT != null) {
- if (U.M.IsUrl(_UCT)) {
- $$("iframe", {
- scrolling: this.Scroll || "no",
- frameBorder: 0,
- width: "100%",
- height: "100%",
- src: _UCT
- }, _UDTD);
- } else if (_UCT) {
- (this.bst) && ($(_UDTD).addAttrArray(this.bst));
- if (U.Ut.isString()) {//添加内容
- _UDTD.innerHTML = _UCT;
- }
- else {
- $(_UDTD).append(_UCT); //添加所选元素
- }
- }
- }
- }
- this.zie = _UAE = {//添加属性size
- fun: U.M.apply(this, this.size)
- };
- _UDTD = $$("div", {//创建_UDTD添加到_UDOD
- className: "UD_W_WT"//添加CLASS属性
- }, _UDOD);
- if (this.draw !== false) {
- for (i = 0; i < _UCE.length; i++) {
- $$("div", {
- className: "UD_W_WT_" + _UCE[i][0],
- onmousedown: [//鼠标事件
- [U.D.RCDG, [_UDOD, _UCE[i][1], _UAE]]
- ]
- }, _UDTD);
- }
- } //允许拉伸
- $(this.SO ? (this.SO[0] || this.SO) : ($("#UD_SY")[0] || document.body)).append(this.be, 0, this.SO ? this.SO[1] : null);
- _USE = this.head ? U.M.GetPDWH(this.head) : null;
- _UDSD = $$("div", {
- className: "UD_SYF_SCA",
- style: {
- "lineHight": _USE ? _USE.CH + "px" : "",
- "top": _USE ? Math.ceil((_USE.OH - 20) / 2) + "px" : "15px" //定义高度属性为(_USE.OH - 20) / 2
- }
- }, _UDOD); //添加至_UDOD
- //功能将处理
- (this.htask) && ($(_UDSD).addAttrArray(this.htask));
- (this.close !== false) && (this.close = this.close || {}, this.cl = $$("div", {
- className: "UD_SYF_SS UD_SYI",
- title: "点击关闭",
- onmousedown: U.M.StopBubble,
- onclick: U.M.apply(this, this.shut)
- }, _UDSD));
- _USE = this.et[this.id] = this;
- //最大化最小化的按钮
- (this.max !== false) && (this.max = this.max || {}, this.m = _UDTD = $$("div", {
- className: "UD_SYF_SD UD_SYI",
- title: "最大化",
- onmousedown: U.M.StopBubble
- }, _UDSD), _UDTD.onclick = U.M.apply(null, [
- [U.D.Windowmaximize, ([_UDOD, _UDTD, {
- fun: U.M.apply(this, [
- [this.size]
- ])
- }, this.head || _UDOD, {
- "onmousedown": (this.head || _UDOD).onmousedown
- }])]
- ]), (this.head) && (this.head.ondblclick = U.M.apply(this.head, function () {
- (event.srcElement == this || U.M.EISE(this, event.srcElement)) && (_UDTD.onclick());
- }))); //
- (this.min !== false) && (this.min = this.min || {}, this.mi = $$("div", {
- className: "UD_SYF_SF UD_SYI",
- title: "最小化",
- onmousedown: U.M.StopBubble,
- onclick: [
- [U.D.WindowMin, [_UDOD]]
- ]
- }, _UDSD));
- }
- //不允许拖动设置
- (_UTE.isContain) && (((_UTE.head) && (_UTE.head.onmousedown = null)) || (_UDOD.onmousedown = null)); //$(_UDOD).css({ position: "static" }),
- _UAE = _UTE.style ? [_UTE.style.top, _UTE.style.left] : [];
- //弹出窗体
- (!this.style || this.style.display != "none") && (U.D[_UAE[0] && (_UAE[0].indexOf("px") > -1 || _UAE[0].indexOf("%") > -1) || _UAE[1] && (_UAE[1].indexOf("px") > -1 || _UAE[1].indexOf("%") > -1) ? "SetDTop" : "PopupWindow"](_UDOD, true));
- _UTE.PSO = _UDOD;
- //设置置顶
- (_UTE.top) && ($(_UTE.be).css("zIndex", 9999));
- _UTE.size(true);
- return _UTE;
- },
- //关闭窗体
- shut: function () {
- if (!this.close || !this.close.onclick || this.close.onclick(this.be) !== false) {
- U.D.CloseWindow(this.be, this.del ? this.del : null); //关闭窗体
- }
- },
- /**
- * 变大缩小适应
- *
- * @param {object} 窗体使用传参
- */
- size: function (UTF) {
- if (this.draw !== false && this.max !== false || this.title !== false) {
- if (!(this.bst && this.bst.height) && this.be.style.height != "auto") { //判断是否为自适应
- var _UH,
- _USE = [this.head ? U.M.GetPDWH(this.head) : [], U.M.GetPDWH(this.body)] //获取padding大小
- //|| (US.Height * 0.7); //等比例百分比
- if (_UH = $(this.be).height()) { $(this.body).css("height", _UH - (_USE[0]["OH"] || 0) - (_USE[1]["PD"][0] || 0) - (_USE[1]["PD"][2] || 0) + "px"); } //大小设置
- }
- if (UTF !== true) { //利用回调函数调用
- (!this.TI && this.resize) && (this.resize.call(this, this.be, this.head, this.body)); //回调窗体变化
- clearTimeout(this.TI);
- this.IsSize = true;
- this.TI = setTimeout(U.M.apply(this, this.sizeend), 0); //窗体结束调用
- }
- }
- },
- //大小变化结束出发
- sizeend: function () {
- this.TI = null;
- (this.resizeend) && (this.resizeend(this.be));
- },
- //窗体变化
- allSize: function () {
- var i, _UDE = this.et;
- for (i in _UDE) {
- if (_UDE[i].IsSize) {
- _UDE[i].IsSize = false;
- } else {
- _UDE[i].size();
- }
- }
- },
- //滚动使用
- scroll: function () {
- if (this.s || this.ss || this.se) {
- (this.s) && (this.s());
- (!this.iss) && (this.scrollStart());
- this.iss = true; //滚动开始触发
- clearTimeout(this.TI);
- this.TI = setTimeout(U.M.apply(this, this.scrollEnd), 0); //触发加载
- }
- },
- //滚动开始
- scrollStart: function () {
- (this.ss) && (this.ss()); //滚动开始回调
- },
- //滚动结束
- scrollEnd: function () {
- (this.se) && (this.se()); //滚动结束回调
- this.iss = false;
- },
- //滚动到底部触发
- scrollBottom: function () {
- },
- //添加属性
- add: function (UDE) {
- U.Ut.AddObj(this, UDE);
- }
- }
- //#endregion
- //#region 编辑器
- /**
- * 嵌入式的编辑器
- *
- * @param {Element} 需要嵌入的位置
- */
- U.UI.Editor = function (el) {
- return U.UI.EditorLoad({ head: true, isc: false, title: false, context: "", parentEle: el });
- }
- /**
- * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
- *
- * @param {object} 窗体使用传参
- * @param {object} 窗体使用传参
- * @return {object} 编辑器
- */
- U.UI.PopEditor = function (UDE, UFE) {
- return U.UI.EditorLoad(UDE, UFE);
- }
- /**
- * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
- *
- * @param {object} 窗体使用传参
- * @param {object} 窗体使用传参
- * @return {object} 编辑器
- */
- U.UI.EditorLoad = function (UDE, UFE) {
- return new U.UI.EditorLoad.init(UDE, UFE).create();
- }
- /**
- * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
- *
- * @param {object} 窗体使用传参
- * @param {object} 窗体使用传参
- * @return {object} 编辑器
- */
- U.UI.EditorLoad.addT = function (UDOD, UTI, UCE) {
- var _UDSD = $$("div", {
- className: "UD_SYSXZBFCAT",
- "style": {
- "display": "block"
- }
- }, UDOD);
- _UDSD = $$("div", {
- className: "UD_SYSXZBFCATX"
- }, _UDSD);
- $$("div", {
- className: "UD_SYSXZBFCATXL",
- "innerHTML": UTI || "主题:"
- }, _UDSD);
- var _UDFD = $$("div", {
- className: "UD_SYSXZBFCATXR"
- }, _UDSD);
- _UDMD = $$("input", {
- className: "UD_SYSXZTST",
- defaultValue: (_UCT = "请输入标题..."),
- "value": UCE,
- placeholder: _UCT,
- onblur: [
- [U.MR.InputTip, ["this", ["", _UCT]]]
- ],
- onfocus: [
- [U.MR.InputTip, ["this", [_UCT, ""]]]
- ]
- }, _UDFD);
- return _UDSD;
- }
- /**
- * 加载编辑器初始化
- *
- * @param {object} 窗体使用传参
- * @param {object} 窗体使用传参
- * @return {object} 编辑器
- */
- U.UI.EditorLoad.init = function (UDE, UFE) {
- this.obj = UDE || {};
- this.rt = UFE || {};
- this.o = [];
- this.extra = [];
- }
- U.UI.EditorLoad.init.prototype = {
- et: {},
- config: function (UDE) { //配置
- if (!this.f) { //初始化配置文件
- this.f = {
- EX: "uerror",
- ADD: "uadd",
- JDT: "ujdt",
- FCP: "ufcp",
- FUP: "ufup",
- CP: "ucp",
- ACP: "ucp"
- };
- for (var i in this.f) {
- this.f[i] = U.M.getFun(U.M.apply(this, this[this.f[i]])).set({
- isremove: false
- }).getId();
- } //生成标签
- }
- this.c = this.c || {
- id: Guid.guidNoDash()
- };
- (UDE) && (U.Ut.AddObj(this.c, UDE));
- return this; //创建值
- },
- set: function (UDE) {
- U.Ut.AddObj(this, UDE);
- }, //自定义允许设置内容
- create: function () { //创建发表框 celbut:false, isc:false
- if (this.obj.cus) {
- this.cuscreate();
- }
- var i, _UCT, _UDTD, _UDSD, _UDFD, _UDBD, _UDMD, _UDND, _UDKD, _UDLD, _UDED, _UDVD, _UDUD, _UDCD, _UAE,
- _UDE = this.obj,
- _USE = {
- "hst": "",
- "bst": "",
- "draw": "",
- "close": "",
- "max": "",
- "min": "",
- "isContain": "",
- "style": ""
- };
- this.config();
- _UDE.id = _UDE.id || Guid.guidNoDash();
- if ((_UAE = this.et[_UDE.id])) {
- (_UDMD = _UAE.ti).value = _UDE.name;
- (_UDND = _UAE.con).innerHTML = _UDE.title;
- $(_UAE.content).parentg({
- usform: "true"
- }).Center();
- }
- else {
- _UAE = this;
- this.content = _UDTD = $$("div", { className: "UD_SYSXZBFCA", id: _UDE.id || "" });
- if (this.obj.title !== false) { //需要添加标题
- _UDMD = this.ti = $("input", U.UI.EditorLoad.addT(_UDTD, "主题", _UDE["title"]))[0];
- }
- if (this.obj.head) { //启动文本功能区域
- this.head = _UDSD = $$("div", {
- "onclick": U.M.apply(this, this.Tool),
- className: "UD_SYSXZBFCAH"
- }, _UDTD);
- _UDUD = $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "position": "relative" }, "title": "本地添加文件" }, _UDSD);
- // <div class="UD_SYZCLTSI" title="上传头像">
- // <input type="file" name="UD_SYZCLTSI" id="UD_SYZCLTSI" multiple="true" accept="image/gif,image/jpeg,image/png" class="UD_uploadbg" onchange="U.U.GLUI(this, [U.U.DI, (['headimg', U.U.MDKSCTX, $(this).Parent()]), 'Userprofile'])">
- // </div>
- // _UDED = $$("input", { type: "file", multiple:"true",accept: "image/gif,image/jpeg,image/png" });
- // _UDED.onchange = U.M.apply(_UDED, [[U.UP.uploading, ([_UDED, U.M.apply(this, [[this.createFile]]),null, "http://disk.1473.cn/USupfile.ashx?iframename=UseStudioEditor"]) ]]);
- // U.UP.uploading([UDOD], UDE[0], UDE[1], "http://main.1473.cn/USupfile.ashx?iframename=" + UDE[2]);
- // _UDKD = $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "position": "relative" }, "title": "本地添加文件",
- // "onmousedown": [[U.Dk.UP.SCXWPOP, (['this', { "width": "25px", "height": "22px", "GS": true, "FCP": U.M.apply(this, [[this.createFile]]), "URL": "http://disk.1473.cn/USupfile.ashx?iframename=UseStudioEditor", "ID": Guid.newGuid() }, US.userInfo.userid, true])]]
- // }, _UDSD);
- if (US && US.userInfo && US.userInfo.userid) {
- $$("div", {
- "className": "UD_SYFDTW UD_SYI UD_SYSXZBFCAHH", "style": { "width": "28px" }, "title": "网盘添加文件",
- "onclick": [[U.Dk.VW.CCWPXZK, ([US.NU, { "onclick": U.M.apply(this, [[this.createFile]]) }, null])]]
- }, _UDSD);
- }
- _UDKD = $$("div", {
- "className": "UD_SYQZI UD_SYQCT UD_SYI UD_SYSXZBFCAHO",
- title: "表情包",
- onclick: [[U.M.StopBubble], [U.UI.face, ["this", U.M.apply(this, this.face)]]]
- }, _UDSD);
- _UDKD = $$("div", {
- "className": "UD_SYQZI UD_SYQZJ UD_SYI UD_SYSXZBFCAHO",
- title: "背景色",
- onclick: [[U.M.StopBubble], [U.OU.ToolOC, ["this"]]]
- }, _UDSD);
- _UDKD = $$("div", {
- "className": "UD_SYQZOB",
- onclick: U.M.apply(this, [
- [this.use, [{ "backgroundColor": "" }, "backgroundColor"]]
- ])
- }, _UDKD);
- _UDLD = $$("div", {
- "className": "UD_SYQZI UD_SYQZZ UD_SYI UD_SYSXZBFCAHO",
- title: "字体色",
- onclick: [
- [U.M.StopBubble],
- [U.OU.ToolOC, ["this"]]
- ]
- }, _UDSD);
- _UDLD = $$("div", {
- "className": "UD_SYQZOB",
- onclick: U.M.apply(this, [
- [this.use, ([{
- "color": ""
- }, "backgroundColor"])]
- ])
- }, _UDLD);
- _UDED = $$("div", {
- "className": "UD_SYQZO UD_SYQZOV UD_SYSXZBFCAHO"
- }, _UDSD);
- _UDED = $$("select", {
- "className": "UD_SYQZV",
- onchange: U.M.apply(this, [[this.use, [{ "fontFamily": "" }, "font"]]])
- }, _UDED);
- _UDVD = $$("div", {
- "className": "UD_SYQZO UD_SYQZOO UD_SYSXZBFCAHO"
- }, _UDSD);
- _UDVD = $$("select", {
- "className": "UD_SYQZVO",
- onchange: U.M.apply(this, [
- [this.use, ([{
- "fontSize": ""
- }, "font"])]
- ])
- }, _UDVD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZLO UD_SYI UD_SYSXZBFCAHO",
- title: "斜体",
- onclick: U.M.apply(this, [
- [this.use, ([{
- fontStyle: ["italic", "normal"]
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZLT UD_SYI UD_SYSXZBFCAHO",
- title: "加粗",
- onclick: U.M.apply(this, [
- [this.use, ([{
- fontWeight: ["bold", "normal"]
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZF UD_SYI UD_SYSXZBFCAHO",
- title: "下划线",
- onclick: U.M.apply(this, [
- [this.use, ([{
- textDecoration: ["underline", "none"]
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZT UD_SYI UD_SYSXZBFCAHO",
- title: "删除线",
- onclick: U.M.apply(this, [
- [this.use, ([{
- textDecoration: ["line-through", "none"]
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQLJ UD_SYI UD_SYSXZBFCAHO",
- title: "超链接",
- ///此处有问题,U.UI只能调用UC中的内容,不能调用其他文件夹地方的内容。
- onclick: [[U.OU.AddUrl, [U.M.apply(this, [[this.AddUrl]])]]]
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZR UD_SYI UD_SYSXZBFCAHO",
- title: "左对齐",
- onclick: U.M.apply(this, [
- [this.use, ([{
- textAlign: "left"
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZRZ UD_SYI UD_SYSXZBFCAHO",
- title: "居中",
- onclick: U.M.apply(this, [
- [this.use, ([{
- textAlign: "center"
- }])]
- ])
- }, _UDSD);
- $$("div", {
- "className": "UD_SYQZI UD_SYQZRL UD_SYI UD_SYSXZBFCAHO",
- title: "右对齐",
- onclick: U.M.apply(this, [
- [this.use, ([{
- textAlign: "right"
- }])]
- ])
- }, _UDSD);
- U.OU.CreatTool([_UDED, _UDVD, _UDKD, _UDLD], [0, 1, 2, 3]);
- $("&*", this.head).addAttrArray({
- "unselectable": "on"
- });
- }
- _UDCD = $$("div", { "innerHTML": "在该处添加内容..." });
- _UCT = _UDCD.outerHTML;
- this.con = {
- className: "UD_SYSXZLRSSI UD_SYSXZBFCO",
- contenteditable: "true",
- onblur: [[U.MR.InputTip, ["this", ["<div></div>", _UCT]]]],
- onfocus: [[U.MR.InputTip, ["this", [_UCT]]]]
- };
- (this.car) && (U.Ut.AddObj(this.cob, this, car));
- this.con = _UDND = $$("div", this.con, _UDTD);
- _UDSD = $$("div", { className: "UD_SYSXZBFCT" }, _UDTD);
- // if (!this.obj.head && this.obj.upload) { //启动上传功能
- // // $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "width": "28px" }, "title": "添加文件",
- // // "onclick": [[U.Dk.HP.FileSwitch, ([US.NU, null, { "FCP": U.M.apply(this, [[this.createFile]]), "CB": U.M.apply(this, [[this.createFile]])}])]]
- // // }, _UDSD);
- // }
- if (this.obj.imgt) {
- (!U.Ut.isNumber(this.obj.imgt)) && (this.obj.imgt = 9);
- this.imgt = _UDBD = $$("div", {
- className: "UD_SYSXZLRSSVON"
- }, _UDSD);
- }
- _$(_USE).Each(function (UA, UB) {
- _USE[UB] = _UDE[UB] == null ? _USE[UB] : _UDE[UB];
- });
- U.Ut.AddObj(_USE, {
- SO: this.obj.parent,
- sizeend: U.M.apply(this, this.size),
- content: _UDTD,
- title: "<div class='UD_SYF_STI'>" + (this.obj.name || "最新发表") + "</div>"
- });
- // this.body = _UDE.parentEle ? $(_UDE.parentEle).append(_UDTD) : U.UI.Form(_USE).be;
- if (_UDE.parentEle) {
- this.body = _UDE.parentEle;
- $(_UDE.parentEle).append(_UDTD)
- }
- else {
- this.body = U.UI.Form(_USE).be;
- //按钮设置
- (this.obj.celbut !== false) && ($$("div", {
- className: "UD_SYSXZBFCTA UD_SYSXZBFCTAT",
- title: "取消",
- "innerHTML": "取消",
- "onclick": this.obj.celbut ? this.obj.celbut : [
- [U.D.CloseWindow, [this.body]]
- ]
- }, _UDSD));
- $$("div", {
- className: "UD_SYSXZBFCTA",
- title: "确定",
- "innerHTML": "确定",
- "onclick": U.M.apply(this, this.fb)
- }, _UDSD);
- }
- //添加flash上传控件
- this.objfl = U.UP.AddFAN(_UDUD, null, { "width": "25px", "height": "22px" });
- //flash上传的参数
- U.UP.FAFZ({ "width": "25px", "height": "22px" },
- {
- "ADD": U.M.apply(this, this.uadd),
- "CP": U.M.apply(this, this.ucp),
- "JDT": U.M.apply(this, this.ujdt),
- "FUP": U.M.apply(this, this.ufup),
- "FCP": U.M.apply(this, this.ufcp)
- }, "M"); //添加上传控件
- this.et[_UDE.id] = this;
- this.r = this.cursor(_UDTD, _UDND); //添加flash按钮
- }
- try {
- (U && U.D && U.D.Tb && U.D.Tb.taskbar) && (U.D.Tb.taskbar({
- bp: "-267px -413px",
- name: (_UAE.obj.name || "最新发表"),
- el: _UAE.body,
- id: _UDE.id,
- click: U.M.apply(_UAE, _UAE.create)
- }));
- } catch (e) { }
- _UAE.size();
- (_UDCD) && (_UAE.r.add(_UDE["context"] || _UCT));
- return _UAE;
- },
- text: function () {
- return this.con.innerHTML.escapeQuotes();
- },
- clear: function () { //清除数据
- var i, _UDE = this.extra;
- for (i = 0; i < _UDE.length; i++) {
- $(_UDE[i]).remove();
- }
- },
- append: function (UDE) { //添加
- var i, _UDOD = $(this.content),
- _UDFD = $$("frag");
- if (U.Ut.isArray(UDE)) {
- for (i = 0; i < UDE.length; i++) {
- this.extra.push(UDE[i]);
- $(_UDFD).append(UDE[i]);
- }
- } //数组添加
- else {
- _$(UDE).Each(function (UVE, UIE) {
- this.extra.push(U.UI.EditorLoad.addT(_UDFD, UVE, UIE));
- });
- }
- _UDOD.append(_UDFD, 0, _UDOD.Child()[0]); //添加
- },
- addButton: function () {
- },
- cuscreate: function () { //自定义样式 { cus:{ tr:发帖按钮, ubox :上传按钮,ti:标题区域 , con:内容区域 ,imgt :阅读查看区域 } }
- var _UDE = this.obj.cus;
- (_UDE.tr && (_UDE.tr.onclick = U.M.apply(this, this.fb), delete _UDE.tr));
- (_UDE.ubox) && (U.UP.AddFAN(_UDE.ubox, this.c.id, {
- width: "100%",
- height: "100%"
- }), U.UP.FAFZ({}, this.f, this.obj.type || "M"), delete _UDE.ubox);
- this.set(_UDE); //设置值使用
- },
- fb: function () { //发表文章
- var _UAS, _UTI, _UDTD = this.ti,
- _UCT = this.con.innerHTML,
- _UDAD = this.imgt ? $(this.imgt).Child() : null;
- if (_UDTD && (_UTI = _UDTD.value) && _UDTD.defaultValue == _UDTD.value) {
- _UAS = "请填写标题";
- _UDTD.focus();
- } //如果没有填写标题
- else if ((_UCT.isStrNull() || _UCT == "有什么和大家分享...") && ((_UCT = "图片分享") && (!_UDAD || !_UDAD.length))) {
- _UAS = "请填写内容";
- this.con.focus();
- } //内容判断
- else {
- if (this.obj.fcb && this.obj.fcb(_UCT, _UTI, _UDAD) !== true) {
- !this.parentEle && (this.obj.close !== false) && (U.D.CloseWindow(this.body, this.isc !== false ? "remove" : ""));
- } else {
- this.con.focus();
- }
- } //编辑框移除
- (_UAS) && (U.Alert(_UAS)); //成功
- },
- jd: function () { //焦点处理
- this.r.CreateR(); //重新记录焦点
- },
- uerror: function (UE) { //上传错误处理
- U.Alert("选择文件错误..");
- },
- Tool: function () { //工具隐藏处理
- var i, _UDTD,
- _UDAD = $(this.head).Child();
- for (i = 0; i < _UDAD.length; i++) {
- _UDTD = $(_UDAD[i]).Child()[0];
- if (_UDTD && _UDTD.tagName.toLowerCase() == "div") { $(_UDTD).css("display", "none"); }
- }
- },
- uadd: function (UDE, UL) { //文件上传添加
- var i, _UL;
- //图片最多上传数量处理
- if (this.obj.imgt) {
- if (this.obj.imgt - UDE.length < 0) {
- _UL = UDE.length - this.obj.imgt;
- for (i = 0; i < _UL; i++) {
- this.objfl.DF(UDE.length - i - 1, this.o.length);
- }
- UDE = UDE.slice(0, this.obj.imgt > UDE.length ? UDE.length : this.obj.imgt);
- } //超过数量
- this.obj.imgt -= UDE.length;
- }
- //设置文件上传的唯一识别id
- for (i = 0; i < UDE.length; i++) {
- UDE[i].id = Guid.newGuid();
- }
- //上传处理
- if (UL && UDE.length) {
- if (this.rt.add) { this.rt.add(UDE, UL) } //上传回调函数
- this.o.push(UDE); //添加到数组中
- (this.o.length == 1) && (this.up(UDE[0], 0, 0))
- }
- },
- up: function (UDE, UI, UJ) { //执行上传
- this.objfl.UpLoad(UJ, UI, (UDE || this.o[UI][UJ]).id); //执行上传
- },
- ujdt: function (UDE, UFID, UTF) { //进度条使用
- (this.rt.jdt) && (this.rt.jdt(UDE)); //返回进度条
- },
- ufup: (function () { //获取上传文件MD5 HASH值
- var asyn = function (r) {
- var context = r.context,
- _UDE = context[1],
- _UFID = context[2];
- r = r.value;
- if (r) {
- this.ufcp(r, _UFID);
- }
- else if ((!this.rt.fup) || (this.rt.fup(_UDE) !== false)) {
- this.objfl.URRUP((this.url || "http://main.1473.cn/USupfile.ashx?iframename=UseStudioEditor&") + "UserId=" + (US.userInfo.userid || US.NU) + "&IsF=true", _UFID, _UDE[1], _UDE[2]);
- }
- },
- _ = function (UWE, UFID) {
- var _UDE = this.getup(UFID);
- if (_UDE[0]) {
- U.A.Request(US.Auth, ["GetFileByHash", UWE, _UDE[0].size, _UDE[0].type.substr(1)], U.M.apply(this, asyn), (["", _UDE, UFID]));
- }
- else {
- this.ufcp(null, UFID)
- }
- }
- return _;
- })(),
- ucp: function (UDE) { //单个文件上传完毕
- },
- ufcp: function (UDE, UFID) { //获取返回值
- this.del(null, UFID); //上传成功后移除
- if (UDE && (!this.rt.fcp || this.rt.fcp(UDE, _UCE))) {
- (UDE.data) && ((UDE = U.M.toList(UDE.data)), UDE = {
- UserFilesServerName: UDE[0],
- UseFilesServerThumbnailName: UDE[1],
- UserFilesID: UDE[2],
- UserFilesSize: UDE[3],
- UserDirectoryEncrypt: UDE[4]
- });
- //服务器返回值处理
- if (UDE.data) {
- UDE = U.M.toList(UDE.data); //转化成json处理
- //服务器返回的
- UDE = {
- UserFilesServerName: UDE[0],
- UseFilesServerThumbnailName: UDE[1],
- UserFilesID: UDE[2],
- UserFilesSize: UDE[3],
- UserDirectoryEncrypt: UDE[4]
- }
- }
- //通过左下角追加崔丽
- if (this.imgt) {
- $$("img", {
- onerror: "U.M.ImgError(this, 2)",
- title: "右键删除",
- src: U.M.GetImgU(UDE.UserFilesServerName),
- alt: U.M.GetImgU(UDE.UserFilesServerName),
- onmouseup: U.M.apply(this, [
- [this.imgdel, ["this"]]
- ]),
- onclick: [
- [U.D.Img.Img, ([null, {
- UserFilesServerName: UDE.UserFilesServerName,
- UseFilesServerThumbnailName: UDE.UseFilesServerThumbnailName
- }])]
- ]
- }, this.imgt);
- }
- else { this.createFile(null, null, null, UDE); } //写入文件
- }
- (_UGE.length) && (this.up(null, 0, 0)); //成功上传后继续上传
- },
- createFile: function (URL, USN, UDOD, UDE) {
- var _UDOD, _UDTD, _UDSD, _UDMD, _UTH, _UGE = this.o;
- if (U.UP.IsImg(UDE.UserFilesServerName)) {
- _UTH = "<span><img onerror='U.M.ImgError(this, 2)' onclick='U.D.Img.Img(null, { 'Thm': '" + U.M.GetImgU(UDE.UserFilesServerName) + "', 'Img': '" + U.M.GetImgU(UDE.UserFilesServerName) + "' src='" + U.M.GetImgU(UDE.UserFilesServerName) + "' alt='" + U.M.GetImgU(UDE.UserFilesServerName) + "' title='点击查看原图' />  </span>"
- }
- else { //普通文件处理
- _UDOD = $$("div", {
- contenteditable: "false",
- style: {
- "cssText": "width:260px; height:70px; background-color:#DDD; display: inline-block; *display:inline; *zoom:1;text-decoration: none; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; text-indent:0"
- }
- });
- _UDTD = $$("div", {
- className: "UD_SYID",
- "style": {
- "cssText": "margin:10px 0 0 10px; width:40px; height:50px; margin:15px 0 0 10px; float:left; background-position:-261px -22px"
- }
- }, _UDOD);
- $$("div", {
- style: {
- cssText: "font-size:15px; width:40px; margin:auto; font-family:'微软雅黑'; text-align:center; color:#888; position:relative; top:16px; height:20px; overflow:hidden;"
- },
- innerHTML: U.UP.GetUpName(UDE.UserFilesServerName)[1]
- }, _UDTD);
- _UDTD = $$("div", {
- style: {
- "cssText": "width:195px; height:100%; margin-left:10px; float:left;"
- }
- }, _UDOD);
- _UDSD = $$("div", {
- style: {
- "cssText": "width:200px; height:35px; line-height:35px;"
- }
- }, _UDTD);
- _UDMD = $$("div", {
- innerHTML: "文档 容量大小 "
- }, _UDSD);
- $$("span", {
- innerHTML: U.UP.FileSize(UDE.UserFilesSize),
- style: {
- cssText: "color:#006699;"
- }
- }, _UDMD);
- _UDSD = $$("div", {
- style: {
- "cssText": "width:200px; height:35px; line-height:35px;"
- }
- }, _UDTD);
- _UDMD = $$("div", {
- style: {
- "cssText": "float:left; width:35px; height:35px;"
- }
- }, _UDSD);
- $$("img", {
- style: {
- "cssText": "width:30px; height:30px;"
- },
- src: U.M.GetImgU(US.userInfo.UserThumbnailImageHead)
- }, _UDMD);
- $$("div", {
- style: {
- "cssText": "float:left;padding:0 8px;max-width:50px;"
- },
- innerHTML: US.userInfo.username
- }, _UDSD);
- $$("a", {
- innerHTML: "点击下载",
- href: "/userpages/UD_XZ.htm?id=" + UDE.UserFilesID + "&type=file",
- target: "_blank"
- }, _UDSD);
- $("*", _UDOD).addAttrArray({
- contenteditable: "false"
- });
- _UTH = "  " + _UDOD.outerHTML + "  ";
- }
- this.r.add(_UTH);
- },
- AddUrl: function (URL) {
- URL = URL.value;
- this.r.add("<a href='" + URL + "' style='color:#3B639F;text-decoration:none;' target='_blank' >" + (URL) + "</a>");
- },
- imgdel: function (UDOD) { //图片删除
- if (event.button == 2) {
- this.obj.imgt++;
- $(UDOD).remove();
- }
- },
- uacp: function () { //所有文件上传完毕
- try {
- (!this.rt.acp) && (this.rt.acp());
- } catch (e) { }
- this.objfl.DAF();
- },
- del: function (UIE, UFID) { //删除上传后的实体
- var _UDE, UJ, _UGE = this.o;
- if (UIE != null) {
- _UGE.splice(UIE, 1);
- } else if (UFID) {
- _UDE = this.getup(UFID);
- (_UDE[0]) && (this.objfl.DF(_UDE[2], _UDE[1]), _UGE[_UDE[1]].splice(_UDE[2], 1), (!_UGE[_UDE[1]].length) && (_UGE.splice(_UDE[1], 1)));
- } //删除上传实体
- (!_UGE.length) && (this.uacp()); //所有的上传完毕
- },
- getup: function (UDID) { //获取上传文件实体
- var i, j, _UDE = this.o;
- for (i = 0; i < _UDE.length; i++) {
- for (j = 0; j < _UDE[i].length; j++) {
- if (_UDE[i][j].id == UDID) {
- return [_UDE[i][j], i, j];
- }
- }
- }
- return [null, -1, -1];
- },
- size: function () { //大小变化
- $(this.content).css("height", $(this.content).parentg().height() - 2 + "px");
- $(this.con).css("height", this.content.offsetHeight - (this.ti ? 115 : 70) - (this.head ? 33 : 0) - 1 + "px");
- },
- use: function (UDE, UTF) { //功能使用
- if (UTF) {
- var i, _UDOD = event.srcElement;
- for (i in UDE) {
- UDE[i] = UTF == "font" ? _UDOD.value + (i == "fontSize" ? "px" : "") : _UDOD.style[UTF];
- }
- }
- this.r.use(UDE);
- },
- cursor: (function () { //光标处理
- var _UDE, _ = function (UDOD, UDTD) {
- return new _UDE.init(UDOD, UDTD).bind();
- }
- _.prototype = _UDE = {
- init: function (UDOD, UDTD) { //初始化变量
- var _UDID = Guid.guidNoDash();
- U.Ut.AddObj(this, {
- iso: false,
- isb: false,
- el: UDOD,
- eb: UDTD,
- id: _UDID,
- sor: U.D.E.GetSelectionRange(window, UDTD, {
- "TF": _UDID
- })
- });
- },
- bind: function () { //事件绑定
- $(this.el).bind({
- mousedown: U.M.apply(this, this.create)
- });
- $(this.eb).bind({
- blur: U.M.apply(this, this.blur),
- focus: U.M.apply(this, this.focus)
- });
- return this; //失去焦点使用
- },
- blur: function () { //失去焦点使用
- if (!this.iso) {
- var _UDE = U.D.E.SORange.OAT[this.id],
- _UL = _UDE.length > 2 ? _UDE.length - 2 : _UDE.length - 1;
- this.sor = _UDE.length > 1 ? _UDE[_UDE.length - 2].OR : this.sor;
- }
- this.isb = true;
- },
- focus: function () { //聚焦使用
- this.isb = false;
- },
- create: function () { //重新添加光标位置
- var _UDOD = this.eb,
- _UDTD = event ? event.srcElement : null;
- this.iso = false;
- ((!_UDTD || (_UDOD !== _UDTD && !U.M.EISE(_UDOD, _UDTD)) && !this.isb)) && (this.sor.CreateR(), this.iso = true);
- },
- add: function (UST) { //写入内容
- this.eb.focus();
- this.sor.Replace(UST, null, true);
- this.sor.CreateR();
- },
- use: function (UDE) { //功能调用使用
- U.D.E.FontSizeType(this.sor.Parent(), UDE, this.sor, this.id);
- }
- }
- _UDE.init.prototype = _UDE;
- return _;
- })(),
- //插入表情包
- face: function (UDOD, UIE) {
- var _UIMG = "/img/ChatingFaceGif/[face](" + UIE + ").gif";
- //$("#UF_FBD")[0].style.display = "none";
- this.r.add(" " + $$("img", { "src": _UIMG, "contentEditable": "true" }).outerHTML + " "); //插入表情包
- }
- }
- //#endregion
- //表情包
- /**
- * 弹出表情框 对应表情框图片 /img/face.gif
- *
- */
- U.UI.face = function (UDOD, UCB) {
- var i, _UDTD,
- _UDOD = $("#UF_FBD")[0];
- if (_UDOD) {
- $("#UF_FBD")[0].style.display = $("#UF_FBD")[0].style.display == "none" ? "block" : "none";
- }
- else {
- _UDOD = $$("div", { "id": "UF_FBD", "class": "UF_FBD", "onmousedown": U.M.StopBubble }, UDOD);
- _UDTD = $$("div", { "class": "UF_FNR" }, _UDOD);
- for (i = 0; i <= 104; i++) {//循环表 情按钮
- $$("div", { "className": "UF_FDG", "onclick": [UCB ? [UCB, [_UDOD, i]] : null] }, _UDTD);
- }
- }
- }
- //#region 对话框
- /**
- * 创建对话框
- * @returns {function} 回调函数初始化
- * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
- */
- U.UI.Confirm = function () {
- return new U.UI.Confirm.init(arguments);
- }
- /**
- * 初始化对话框实例
- * @returns {function} 回调函数初始化
- * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
- */
- U.UI.Confirm.init = function (UDE) {
- var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "top"];
- if (UDE.length < 4) {
- var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
- UDE = ["消息提示", { "width": "300px" }, UDE[2], UDE[1],
- $$("div", {
- "className": "U_UI_OC",
- "style": {
- "textAlign": "center",
- "margin": "25px 0",
- "max-width": "400px",
- "word-wrap": "break-word",
- "max-height": "400px",
- "overflow": "auto"
- },
- innerHTML: UDE[0] ? UDE[0] : ""
- })];
- }
- for (i = 0; i < UDE.length; i++) {
- this[_UCE[i]] = UDE[i];
- }
- this.Create();
- }
- U.UI.Confirm.init.prototype = {
- /**
- * 创建对话框的ui
- */
- Create: function () {
- var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
- width: "auto",
- height: "auto"
- },
- _UEK = (this.style = this.style || {});
- _$(_USE).Each(function (UA, UB) {
- _UEK[UB] = _UEK[UB] || UA;
- });
- _UEK.zIndex = 9999;
- var _frag = $$("frag");
- _UDOD = $$("div", { "className": "U_UI_OB" });
- _UDTD = $$("div", { "className": "U_UI_OBA" }, _UDOD);
- this.No = $$("div", {
- "onclick": U.M.apply(this, [[this.confirmYesNo, [this.confirmNoClose]]]), // [(U.Ut.isArray(this.confirmNoClose) ? this.confirmNoClose : [this.confirmNoClose]), [(_UCB = U.M.apply(_UDE, [[_UDE.shut]]))]],
- "innerHTML": "取消",
- "style": { "display": this.Q == true ? "none" : "block" },
- "className": "U_UI_OBY"
- }, _UDTD);
- this.Yes = _UDSD = $$("div", {
- "onclick": U.M.apply(this, [[this.confirmYesNo, [this.confirmYesClose]]]), //[(U.Ut.isArray(this.confirmYesClose) ? this.confirmYesClose : [this.confirmYesClose]), [_UCB]],
- "innerHTML": "确定",
- "className": "U_UI_OBY"
- }, _UDTD); //确定按钮
- _frag.appendChild(this.content);
- _frag.appendChild(_UDOD);
- this.form = _UDE = U.UI.Form({
- id: "U_COF",
- top: this.top ? true : false,
- min: false,
- max: false,
- style: this.style,
- title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
- content: _frag,
- hst: {
- style: {
- padding: "0"
- }
- },
- draw: false
- }); //创建对话框
- // $(_UDE.body).append(_UDOD);
- _UDID = $("input", _UDE.body);
- for (i = _UDID.length - 1; i >= 0; i--) {
- if ("text,password".indexOf(_UDID[i].type) > -1) {
- _UDID[i].focus();
- _UDID[i].onkeypress = U.M.apply(_UDID[i], [
- [U.M.returnkeylogin, ([
- [{
- "obj": _UDSD,
- "event": 'onclick'
- }]
- ])]
- ]);
- }
- }
- return _UDE;
- },
- /**
- * 给对话框设置事件
- * @param {object} 窗体事件使用
- ----------[yes] {function} 确定的函数事件
- ----------[no] {function} 取消的函数事件
- */
- AddEvent: function (UDE) {
- for (var i in UDE) {
- if (UDE.hasOwnProperty(i)) {
- this[i].onclick = U.M.apply(this.form, [[this.form.shut], UDE[i]]); //
- }
- }
- },
- /**
- * 给对话框设置事件
- * @param {object} 窗体事件使用
- */
- confirmYesNo: function (UFN) {
- var _UCB = U.M.apply(this.form, [[this.form.shut]]), //关闭窗体的函数
- _UTF = U.Ut.isArray(UFN) ? U.M.apply(this, [UFN])() : (UFN) && (UFN.call(this));
- if (_UTF !== false) { //不允许关闭
- _UCB();
- }
- // [(U.Ut.isArray(this.confirmNoClose) ? this.confirmNoClose : [this.confirmNoClose]), [(_UCB = U.M.apply(_UDE, [[_UDE.shut]]))]]
- }
- }
- /*U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
- (!UDW || !UDH) && (UDW = "400px", UDH = "550px");
- return U.UI.From({
- id: UDID ? UDID : null,
- style: { "width": parseInt(UDW) + "px", "height": parseInt(UDH) + "px" },
- content: UDC ? UDC : null, title: UDT ? UDT : "通知",
- min: false,
- max: false,
- draw: false
- });
- }*/
- //U.UI.Confirm = function (UCT, UCBF, UCNF) {
- // var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
- // if (_UDOD[0]) { //判断是否有U_COF的子节点,没有则创建
- // _UDOD.childg(0, 1).childg(0, 0).html(UCT); //设置内容
- // _UDOD.Center(); //内容居中
- // } else {
- // $(U.UI.Dialog("消息提示", {}, UCNF ? U.M.apply(this, [UCNF]) : null, UCBF ? U.M.apply(this, [UCBF]) : null,
- // $$("div", {
- // "className": "U_UI_OC",
- // "style": {
- // "textAlign": "center",
- // "padding": "25px 0 25px 0"
- // },
- // innerHTML: UCT
- // })).Create()).addAttrArray({
- // "id": "U_COF"
- // })[0];
- // U.M.StopBubble(); //阻止冒泡
- // return _UDOD;
- //}
- /**
- * 创建一个通知形式的对话框
- *{str} UDC 对话框里面的内容。
- *{str} UDT 标题
- *{str} UDID 对话框id
- *{int} UDW 宽度
- *{int} UDH 高度
- * @returns 返回ID为U_COF的对象
- **/
- U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
- return new U.UI.Dialog.init(arguments);
- }
- U.M.Setprototype(U.UI.Dialog, U.Ut.AddObj(U.UI.Dialog, {
- init: function (UDE) { //添加对话框信息
- var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "SO"];
- for (i = 0; i < UDE.length; i++) {
- this[_UCE[i]] = UDE[i];
- }
- },
- Create: function () { //创建对话框
- var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
- width: "auto",
- height: "auto",
- minWidth: "300px"
- },
- _UEK = (this.style = this.style || {});
- _$(_USE).Each(function (UA, UB) {
- _UEK[UB] = _UEK[UB] || UA;
- });
- _UEK.zIndex = 9999;
- _UDE = U.UI.Form({
- top: true,
- min: false,
- max: false,
- style: this.style,
- title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
- content: this.content,
- hst: {
- style: {
- padding: "0"
- }
- }
- }); //创建对话框
- _UDOD = $$("div", {
- "className": "U_UI_OB"
- });
- _UDTD = $$("div", {
- "className": "U_UI_OBA"
- }, _UDOD);
- $$("div", {
- "onclick": [
- [this.confirmNoClose],
- [(_UCB = U.M.apply(_UDE, [
- [_UDE.close]
- ]))]
- ],
- "innerHTML": "取消",
- "className": "U_UI_OBY"
- }, _UDTD);
- _UDSD = $$("div", {
- "onclick": [
- [this.confirmYesClose],
- [_UCB]
- ],
- "innerHTML": "确定",
- "className": "U_UI_OBY"
- }, _UDTD); //确定按钮
- $(_UDE.body).append(_UDOD);
- _UDID = $("input", _UDE.body);
- for (i = _UDID.length - 1; i >= 0; i--) {
- if ("text,password".indexOf(_UDID[i].type) > -1) {
- _UDID[i].focus();
- _UDID[i].onkeypress = U.M.apply(_UDID[i], [
- [U.M.returnkeylogin, ([
- [{
- "obj": _UDSD,
- "event": 'onclick'
- }]
- ])]
- ]);
- }
- }
- }
- }));
- U.UI.Dialog.init.prototype = U.UI.Dialog.prototype;
- //#endregion
- //#region RadioList
- U.M.Setprototype(U.UI.RadioList, U.Ut.AddObj(U.UI.RadioList, {
- init: function (UDOD, UDE, UCB) {
- this.UDTD;
- this.UDE = UDE;
- this.UDOD = UDOD;
- this.UCB = UCB;
- this.create(UDOD);
- }, //生成RadioList
- create: function (UDOD) {
- var i, _UDTD, _UDE = this.UDE,
- _UN = Guid.guidNoDash(),
- _UDFD = $$("frag");
- if (_UDE) {
- UDOD.innerText = "";
- for (i in UDE) {
- if (UDE.hasOwnProperty(i)) {
- _UDTD = $$("div", {
- "innerHTML": UDE[i],
- "style": {
- "cssText": "margin-left:5px;"
- }
- }, _UDFD);
- _UDTD = $$("input", {
- "type": "radio",
- "value": i,
- "name": _UN,
- "checked": i ? false : true,
- "onclick": U.M.apply(this, this.chang)
- }, _UDTD);
- (!i) && (this.UDTD = _UDTD);
- }
- }
- UDOD.appendChild(_UDFD);
- } else {
- _UDTD = $("input[type='radio']", UDOD).addAttrArray({
- "name": _UN,
- "onclick": U.M.apply(this, this.chang)
- });
- for (i = 0; i < _UDTD.length; i++) {
- if (_UDTD[i].checked) {
- this.UDTD = _UDTD[i];
- break;
- }
- }
- } //设置相同的name
- },
- value: function () {
- return this.UDTD.value;
- }, //当前聚焦元素的值
- element: function () {
- return this.UDTD;
- }, //当前聚焦元素
- chang: function () {
- var _UDOD = event.srcElement;
- (_UDOD != this.UDTD) && (this.UDTD = _UDOD, (this.UCB) && (this.UCB(_UDOD)));
- } //改变事件
- }));
- U.UI.RadioList.init.prototype = U.UI.RadioList.prototype;
- //#endregion
- //#region alert
- /*
- 弹出提示框,为了同时弹出多个提示框,为多份实例对象
- 1、可以像java语言的用法,用new调用多份,例如: var a=new U.AlertB();
- 2、也可以省略new的步骤,直接U.Alert(),出来的结果为多份。
- 参数一:UTH 内容
- 参数二:UTI 无确认按钮的显示时间
- 参数三:是否带确认按钮
- 返回值:
- */
- U.Alert = function (UTH, UTI, IFQ) {
- IFQ === true ? new U.AlertA(UTH, IFQ) : new U.AlertB(UTH, UTI);
- }
- //为了多份实例,另外建立一个类似类的函数。
- //带有确定按钮的alert
- U.AlertA = function (UTH) {
- U.UI.Confirm("提示框", {}, null, null, $$("div", {
- "style": {
- "textAlign": "center",
- "margin": "25px 10px 25px 10px",
- "max-width": "400px",
- "word-wrap": "break-word",
- "max-height": "400px",
- "overflow": "auto"
- },
- innerHTML: UTH
- }), true);
- }
- //自动消失的alert
- U.AlertB = function (UTH, UTI) {
- this.TI = ((UTI == null || UTI < 0) ? 1000 : UTI);
- var _UDPD = $("body")[0];
- this.UDOD = $($$("div", {
- "innerHTML": UTH,
- "className": "USalert",
- "style": { "cssText": "z-index:9999;left:" + ((US.Width / 2 - 160) + _UDPD.scrollLeft) + "px;top:" + ((US.Height / 2 - 100) + _UDPD.scrollTop) + "px" },
- "onclick": U.M.apply(this, [[this.DAlert, [true]]])
- }, $("body")[0])).animate({
- "top": US.Height / 2 - 80 + _UDPD.scrollTop + "px"
- }, 300, U.M.apply(this, this.AsynAmAlert));
- }
- //为了减少内存消耗,把方法写在原型中。
- U.AlertB.prototype = {
- // init: function (UTH, UTI) {//创建alert "id": "USalert",
- // this.TI = ((UTI == null || UTI < 0) ? 1000 : UTI); this.UDOD = $($$("div", { "innerHTML": UTH, "className": "USalert", "style": { "cssText": "z-index:9999;left:" + (US.Width / 2 - 160) + "px;top:" + (US.Height / 2 - 100) + "px" }, "onclick": U.M.apply(this, [[this.DAlert, [true]]]) }, $("body")[0])).animate({ "top": US.Height / 2 - 80 + "px" }, 300, U.M.apply(this, this.AsynAmAlert));
- // },
- AsynAmAlert: function () { //等待动画
- this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
- },
- AmAlert: function () { //结束动画
- (this.UTI) && (clearTimeout(this.UTI));
- var _UDOD = $(this.UDOD);
- (_UDOD.Parent() == document.body) && (_UDOD.animate({
- "top": _UDOD[0].offsetTop - 70 + "px"
- }, 100, U.M.apply(this, this.DAlert)));
- },
- DAlert: function (UTF) { //移除alert
- if (this.TI || UTF) {
- $(this.UDOD).remove();
- }
- }
- }
- //U.M.Setprototype(U.AlertB, {
- // // init: function (UTH, UTI) {//创建alert "id": "USalert",
- // // this.TI = ((UTI == null || UTI < 0) ? 1000 : UTI); this.UDOD = $($$("div", { "innerHTML": UTH, "className": "USalert", "style": { "cssText": "z-index:9999;left:" + (US.Width / 2 - 160) + "px;top:" + (US.Height / 2 - 100) + "px" }, "onclick": U.M.apply(this, [[this.DAlert, [true]]]) }, $("body")[0])).animate({ "top": US.Height / 2 - 80 + "px" }, 300, U.M.apply(this, this.AsynAmAlert));
- // // },
- // AsynAmAlert: function () {//等待动画
- // this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
- // },
- // AmAlert: function () {//结束动画
- // (this.UTI) && (clearTimeout(this.UTI)); var _UDOD = $(this.UDOD);
- // (_UDOD.Parent() == document.body) && (_UDOD.animate({ "top": US.Height / 2 - 70 + "px" }, 100, U.M.apply(this, this.DAlert)));
- // },
- // DAlert: function (UTF) { //移除alert
- // if (this.TI || UTF) { $(this.UDOD).remove(); }
- // }
- //}); //U.Ut.AddObj(U.Alert,})
- //U.Alert.prototype.init.prototype = U.Alert.prototype;
- //#endregion
|