U.UI.js 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524
  1. //#region UI区域
  2. //UI窗体区域
  3. Namespace.register("U.UI") //窗体的命名空间
  4. //选择框使用
  5. U.UI.RadioList = function (UDOD, UDE, UCB) {
  6. return new U.UI.RadioList.init(UDOD, UDE, UCB);
  7. }
  8. //#region 窗体
  9. /*
  10. Form窗体的使用
  11. 1、可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
  12. 2、也可以省略new的步骤,直接U.Alert(),出来的结果为多份。
  13. 3、多窗口模式调用方法,var e= U.UI.From (UDE); e.addExtendForm();
  14. 参数一:_UFE[add "name":"add"]
  15. 参数二:_UTT 存放大小变化的值
  16. 返回值:
  17. */
  18. /**
  19. * 可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
  20. *
  21. * @param {object} 窗体使用传参
  22. ----------min 是否允许最小化
  23. ----------max 是否允许最大化
  24. ----------id 窗体id
  25. ----------style 窗体的样式
  26. ----------content 窗体的内容
  27. ----------title 窗体的标题
  28. ----------hst 标题设置
  29. ----------cst 内容设置
  30. ---------__top__ 是否允许点击置顶
  31. * @return {object} 窗体实体
  32. */
  33. U.UI.Form = U.UI.From = function (UDE) {
  34. return new U.UI.Form.init(UDE).create();
  35. }
  36. /**
  37. * 可以像java语言的用法,用new调用多份,例如: var a=new U.UI.Form();
  38. *
  39. * @param {object} 窗体使用传参
  40. ----------min 是否允许最小化
  41. ----------max 是否允许最大化
  42. ----------id 窗体id
  43. ----------style 窗体的样式
  44. ----------content 窗体的内容
  45. ----------title 窗体的标题
  46. ----------hst 标题设置
  47. ----------bst 内容设置
  48. ----------draw 是否允许拉伸
  49. * @return {object} 窗体本身
  50. */
  51. U.UI.Form.init = function (UDE) { //初始化
  52. U.Ut.AddObj(this, UDE);
  53. return this;
  54. }
  55. U.UI.Form.et = {}; //所有窗体集合
  56. //窗体使用函数
  57. U.UI.Form.init.prototype = {
  58. et: U.UI.Form.et, //所有窗体集合
  59. //构建元素
  60. create: function () {
  61. var i, _USE, _UDOD, _UDTD, _UDSD, _UAE, _UTE = this,
  62. _UTI = this.title, //标题元素
  63. _UCT = this.content, //内容元素
  64. _UCE = [
  65. ["H", "up"],
  66. ["HL", "topRight"],
  67. ["HR", "topleft"],
  68. ["ML", "left"],
  69. ["MR", "right"],
  70. ["B", "down"],
  71. ["BL", "bottomLeft"],
  72. ["BR", "bottomRight"]
  73. ];
  74. if (this.id && this.et[this.id] && this.et[this.id].be.id == this.id) { //无需创建
  75. _UTE = this.et[this.id]; //获取当前窗体属性
  76. _UTE.be.style.cssText = "";
  77. (_UTE.body) && (_UTE.body.style.cssText = "");
  78. $(_UTE.be).addAttrArray({
  79. className: this.className ? this.className : "UD_SYF_S UD_SYKO", //css样式名"UD_SYF_S UD_SYKO"
  80. close: U.M.apply(_UTE, _UTE.shut),
  81. "__top__": this.top ? "false" : "", //是否允许点击置顶
  82. "__right__": this.right || "",
  83. usform: "true", //设置窗体属性
  84. "id": this.id || "", //绑定继承ID
  85. "style": this.style || {}
  86. });
  87. ($(_UTE.body).addAttrArray(this.bst));
  88. (_UTI && (_UTE.title = _UTI)) && (U.Ut.isString(_UTI) ? (_UTE.head.innerHTML = _UTI) : (_UTE.head.innerHTML = "", $(_UTE.head).append(_UTI))); //重新设置标题
  89. (_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)))); //内容设置
  90. _UDOD = _UTE.be;
  91. }
  92. else { //创建窗体
  93. (this.be = _UDOD = $$("div", { //创建元素
  94. className: this.className ? this.className : "UD_SYF_S UD_SYKO", //css样式名"UD_SYF_S UD_SYKO"
  95. close: U.M.apply(this, this.shut),
  96. "__top__": this.top ? "false" : "", //是否允许点击置顶
  97. "__right__": this.right || "",
  98. usform: "true", //设置窗体属性
  99. "id": this.id || "", //绑定继承ID
  100. "style": this.style || {}
  101. })).onresize = U.M.apply(this, [[this.size]]); //设置元素变化事件
  102. (this.attr) && ($(this.be).addAttrArray(this.attr));
  103. if (this.title !== false) {
  104. this.head = _UDTD = $$("div", {
  105. className: "UD_SYF_ST",
  106. onmousedown: [[U.D.DragMouseDown, [_UDOD, null, this]]] //窗体拖动//鼠标事件按下发生
  107. }, _UDOD);
  108. //重载hst为headerStyle,更加语义化.
  109. (this.headerStyle) && ($(_UDTD).addAttrArray(this.headerStyle));
  110. (this.hst) && ($(_UDTD).addAttrArray(this.hst)); //给标题头部添加样式
  111. (_UTI != null) && ($(_UDTD).append(_UTI)); //添加头部
  112. } else if (this.draw !== false) {
  113. _UDOD.onmousedown = U.M.apply(_UDOD, [[U.D.DragMouseDown, [_UDOD]]]); //窗体拖动
  114. }
  115. if (this.content !== false) {//判断元素是否有bst,添加
  116. _UDTD = $$("div", {
  117. className: "UD_SYF_SC"
  118. }, _UDOD);
  119. this.body = _UDTD = $$("div", {
  120. usbody: "true",
  121. className: "UD_SYF_SCO"
  122. }, _UDTD);
  123. (this.bst) && ($(this.body).addAttrArray(this.bst));
  124. $(_UDTD).bind("scroll", U.M.apply(this, this.scroll)); //避免闭包耗费资源。
  125. //iframe的处理方式
  126. if (_UCT != null) {
  127. if (U.M.IsUrl(_UCT)) {
  128. $$("iframe", {
  129. scrolling: this.Scroll || "no",
  130. frameBorder: 0,
  131. width: "100%",
  132. height: "100%",
  133. src: _UCT
  134. }, _UDTD);
  135. } else if (_UCT) {
  136. (this.bst) && ($(_UDTD).addAttrArray(this.bst));
  137. if (U.Ut.isString()) {//添加内容
  138. _UDTD.innerHTML = _UCT;
  139. }
  140. else {
  141. $(_UDTD).append(_UCT); //添加所选元素
  142. }
  143. }
  144. }
  145. }
  146. this.zie = _UAE = {//添加属性size
  147. fun: U.M.apply(this, this.size)
  148. };
  149. _UDTD = $$("div", {//创建_UDTD添加到_UDOD
  150. className: "UD_W_WT"//添加CLASS属性
  151. }, _UDOD);
  152. if (this.draw !== false) {
  153. for (i = 0; i < _UCE.length; i++) {
  154. $$("div", {
  155. className: "UD_W_WT_" + _UCE[i][0],
  156. onmousedown: [//鼠标事件
  157. [U.D.RCDG, [_UDOD, _UCE[i][1], _UAE]]
  158. ]
  159. }, _UDTD);
  160. }
  161. } //允许拉伸
  162. $(this.SO ? (this.SO[0] || this.SO) : ($("#UD_SY")[0] || document.body)).append(this.be, 0, this.SO ? this.SO[1] : null);
  163. _USE = this.head ? U.M.GetPDWH(this.head) : null;
  164. _UDSD = $$("div", {
  165. className: "UD_SYF_SCA",
  166. style: {
  167. "lineHight": _USE ? _USE.CH + "px" : "",
  168. "top": _USE ? Math.ceil((_USE.OH - 20) / 2) + "px" : "15px" //定义高度属性为(_USE.OH - 20) / 2
  169. }
  170. }, _UDOD); //添加至_UDOD
  171. //功能将处理
  172. (this.htask) && ($(_UDSD).addAttrArray(this.htask));
  173. (this.close !== false) && (this.close = this.close || {}, this.cl = $$("div", {
  174. className: "UD_SYF_SS UD_SYI",
  175. title: "点击关闭",
  176. onmousedown: U.M.StopBubble,
  177. onclick: U.M.apply(this, this.shut)
  178. }, _UDSD));
  179. _USE = this.et[this.id] = this;
  180. //最大化最小化的按钮
  181. (this.max !== false) && (this.max = this.max || {}, this.m = _UDTD = $$("div", {
  182. className: "UD_SYF_SD UD_SYI",
  183. title: "最大化",
  184. onmousedown: U.M.StopBubble
  185. }, _UDSD), _UDTD.onclick = U.M.apply(null, [
  186. [U.D.Windowmaximize, ([_UDOD, _UDTD, {
  187. fun: U.M.apply(this, [
  188. [this.size]
  189. ])
  190. }, this.head || _UDOD, {
  191. "onmousedown": (this.head || _UDOD).onmousedown
  192. }])]
  193. ]), (this.head) && (this.head.ondblclick = U.M.apply(this.head, function () {
  194. (event.srcElement == this || U.M.EISE(this, event.srcElement)) && (_UDTD.onclick());
  195. }))); //
  196. (this.min !== false) && (this.min = this.min || {}, this.mi = $$("div", {
  197. className: "UD_SYF_SF UD_SYI",
  198. title: "最小化",
  199. onmousedown: U.M.StopBubble,
  200. onclick: [
  201. [U.D.WindowMin, [_UDOD]]
  202. ]
  203. }, _UDSD));
  204. }
  205. //不允许拖动设置
  206. (_UTE.isContain) && (((_UTE.head) && (_UTE.head.onmousedown = null)) || (_UDOD.onmousedown = null)); //$(_UDOD).css({ position: "static" }),
  207. _UAE = _UTE.style ? [_UTE.style.top, _UTE.style.left] : [];
  208. //弹出窗体
  209. (!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));
  210. _UTE.PSO = _UDOD;
  211. //设置置顶
  212. (_UTE.top) && ($(_UTE.be).css("zIndex", 9999));
  213. _UTE.size(true);
  214. return _UTE;
  215. },
  216. //关闭窗体
  217. shut: function () {
  218. if (!this.close || !this.close.onclick || this.close.onclick(this.be) !== false) {
  219. U.D.CloseWindow(this.be, this.del ? this.del : null); //关闭窗体
  220. }
  221. },
  222. /**
  223. * 变大缩小适应
  224. *
  225. * @param {object} 窗体使用传参
  226. */
  227. size: function (UTF) {
  228. if (this.draw !== false && this.max !== false || this.title !== false) {
  229. if (!(this.bst && this.bst.height) && this.be.style.height != "auto") { //判断是否为自适应
  230. var _UH,
  231. _USE = [this.head ? U.M.GetPDWH(this.head) : [], U.M.GetPDWH(this.body)] //获取padding大小
  232. //|| (US.Height * 0.7); //等比例百分比
  233. 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"); } //大小设置
  234. }
  235. if (UTF !== true) { //利用回调函数调用
  236. (!this.TI && this.resize) && (this.resize.call(this, this.be, this.head, this.body)); //回调窗体变化
  237. clearTimeout(this.TI);
  238. this.IsSize = true;
  239. this.TI = setTimeout(U.M.apply(this, this.sizeend), 0); //窗体结束调用
  240. }
  241. }
  242. },
  243. //大小变化结束出发
  244. sizeend: function () {
  245. this.TI = null;
  246. (this.resizeend) && (this.resizeend(this.be));
  247. },
  248. //窗体变化
  249. allSize: function () {
  250. var i, _UDE = this.et;
  251. for (i in _UDE) {
  252. if (_UDE[i].IsSize) {
  253. _UDE[i].IsSize = false;
  254. } else {
  255. _UDE[i].size();
  256. }
  257. }
  258. },
  259. //滚动使用
  260. scroll: function () {
  261. if (this.s || this.ss || this.se) {
  262. (this.s) && (this.s());
  263. (!this.iss) && (this.scrollStart());
  264. this.iss = true; //滚动开始触发
  265. clearTimeout(this.TI);
  266. this.TI = setTimeout(U.M.apply(this, this.scrollEnd), 0); //触发加载
  267. }
  268. },
  269. //滚动开始
  270. scrollStart: function () {
  271. (this.ss) && (this.ss()); //滚动开始回调
  272. },
  273. //滚动结束
  274. scrollEnd: function () {
  275. (this.se) && (this.se()); //滚动结束回调
  276. this.iss = false;
  277. },
  278. //滚动到底部触发
  279. scrollBottom: function () {
  280. },
  281. //添加属性
  282. add: function (UDE) {
  283. U.Ut.AddObj(this, UDE);
  284. }
  285. }
  286. //#endregion
  287. //#region 编辑器
  288. /**
  289. * 嵌入式的编辑器
  290. *
  291. * @param {Element} 需要嵌入的位置
  292. */
  293. U.UI.Editor = function (el) {
  294. return U.UI.EditorLoad({ head: true, isc: false, title: false, context: "", parentEle: el });
  295. }
  296. /**
  297. * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
  298. *
  299. * @param {object} 窗体使用传参
  300. * @param {object} 窗体使用传参
  301. * @return {object} 编辑器
  302. */
  303. U.UI.PopEditor = function (UDE, UFE) {
  304. return U.UI.EditorLoad(UDE, UFE);
  305. }
  306. /**
  307. * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
  308. *
  309. * @param {object} 窗体使用传参
  310. * @param {object} 窗体使用传参
  311. * @return {object} 编辑器
  312. */
  313. U.UI.EditorLoad = function (UDE, UFE) {
  314. return new U.UI.EditorLoad.init(UDE, UFE).create();
  315. }
  316. /**
  317. * 编辑器区域,博客发帖,论坛发帖,word编辑区域的公有属性。
  318. *
  319. * @param {object} 窗体使用传参
  320. * @param {object} 窗体使用传参
  321. * @return {object} 编辑器
  322. */
  323. U.UI.EditorLoad.addT = function (UDOD, UTI, UCE) {
  324. var _UDSD = $$("div", {
  325. className: "UD_SYSXZBFCAT",
  326. "style": {
  327. "display": "block"
  328. }
  329. }, UDOD);
  330. _UDSD = $$("div", {
  331. className: "UD_SYSXZBFCATX"
  332. }, _UDSD);
  333. $$("div", {
  334. className: "UD_SYSXZBFCATXL",
  335. "innerHTML": UTI || "主题:"
  336. }, _UDSD);
  337. var _UDFD = $$("div", {
  338. className: "UD_SYSXZBFCATXR"
  339. }, _UDSD);
  340. _UDMD = $$("input", {
  341. className: "UD_SYSXZTST",
  342. defaultValue: (_UCT = "请输入标题..."),
  343. "value": UCE,
  344. placeholder: _UCT,
  345. onblur: [
  346. [U.MR.InputTip, ["this", ["", _UCT]]]
  347. ],
  348. onfocus: [
  349. [U.MR.InputTip, ["this", [_UCT, ""]]]
  350. ]
  351. }, _UDFD);
  352. return _UDSD;
  353. }
  354. /**
  355. * 加载编辑器初始化
  356. *
  357. * @param {object} 窗体使用传参
  358. * @param {object} 窗体使用传参
  359. * @return {object} 编辑器
  360. */
  361. U.UI.EditorLoad.init = function (UDE, UFE) {
  362. this.obj = UDE || {};
  363. this.rt = UFE || {};
  364. this.o = [];
  365. this.extra = [];
  366. }
  367. U.UI.EditorLoad.init.prototype = {
  368. et: {},
  369. config: function (UDE) { //配置
  370. if (!this.f) { //初始化配置文件
  371. this.f = {
  372. EX: "uerror",
  373. ADD: "uadd",
  374. JDT: "ujdt",
  375. FCP: "ufcp",
  376. FUP: "ufup",
  377. CP: "ucp",
  378. ACP: "ucp"
  379. };
  380. for (var i in this.f) {
  381. this.f[i] = U.M.getFun(U.M.apply(this, this[this.f[i]])).set({
  382. isremove: false
  383. }).getId();
  384. } //生成标签
  385. }
  386. this.c = this.c || {
  387. id: Guid.guidNoDash()
  388. };
  389. (UDE) && (U.Ut.AddObj(this.c, UDE));
  390. return this; //创建值
  391. },
  392. set: function (UDE) {
  393. U.Ut.AddObj(this, UDE);
  394. }, //自定义允许设置内容
  395. create: function () { //创建发表框 celbut:false, isc:false
  396. if (this.obj.cus) {
  397. this.cuscreate();
  398. }
  399. var i, _UCT, _UDTD, _UDSD, _UDFD, _UDBD, _UDMD, _UDND, _UDKD, _UDLD, _UDED, _UDVD, _UDUD, _UDCD, _UAE,
  400. _UDE = this.obj,
  401. _USE = {
  402. "hst": "",
  403. "bst": "",
  404. "draw": "",
  405. "close": "",
  406. "max": "",
  407. "min": "",
  408. "isContain": "",
  409. "style": ""
  410. };
  411. this.config();
  412. _UDE.id = _UDE.id || Guid.guidNoDash();
  413. if ((_UAE = this.et[_UDE.id])) {
  414. (_UDMD = _UAE.ti).value = _UDE.name;
  415. (_UDND = _UAE.con).innerHTML = _UDE.title;
  416. $(_UAE.content).parentg({
  417. usform: "true"
  418. }).Center();
  419. }
  420. else {
  421. _UAE = this;
  422. this.content = _UDTD = $$("div", { className: "UD_SYSXZBFCA", id: _UDE.id || "" });
  423. if (this.obj.title !== false) { //需要添加标题
  424. _UDMD = this.ti = $("input", U.UI.EditorLoad.addT(_UDTD, "主题", _UDE["title"]))[0];
  425. }
  426. if (this.obj.head) { //启动文本功能区域
  427. this.head = _UDSD = $$("div", {
  428. "onclick": U.M.apply(this, this.Tool),
  429. className: "UD_SYSXZBFCAH"
  430. }, _UDTD);
  431. _UDUD = $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "position": "relative" }, "title": "本地添加文件" }, _UDSD);
  432. // <div class="UD_SYZCLTSI" title="上传头像">
  433. // <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'])">
  434. // </div>
  435. // _UDED = $$("input", { type: "file", multiple:"true",accept: "image/gif,image/jpeg,image/png" });
  436. // _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"]) ]]);
  437. // U.UP.uploading([UDOD], UDE[0], UDE[1], "http://main.1473.cn/USupfile.ashx?iframename=" + UDE[2]);
  438. // _UDKD = $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "position": "relative" }, "title": "本地添加文件",
  439. // "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])]]
  440. // }, _UDSD);
  441. if (US && US.userInfo && US.userInfo.userid) {
  442. $$("div", {
  443. "className": "UD_SYFDTW UD_SYI UD_SYSXZBFCAHH", "style": { "width": "28px" }, "title": "网盘添加文件",
  444. "onclick": [[U.Dk.VW.CCWPXZK, ([US.NU, { "onclick": U.M.apply(this, [[this.createFile]]) }, null])]]
  445. }, _UDSD);
  446. }
  447. _UDKD = $$("div", {
  448. "className": "UD_SYQZI UD_SYQCT UD_SYI UD_SYSXZBFCAHO",
  449. title: "表情包",
  450. onclick: [[U.M.StopBubble], [U.UI.face, ["this", U.M.apply(this, this.face)]]]
  451. }, _UDSD);
  452. _UDKD = $$("div", {
  453. "className": "UD_SYQZI UD_SYQZJ UD_SYI UD_SYSXZBFCAHO",
  454. title: "背景色",
  455. onclick: [[U.M.StopBubble], [U.OU.ToolOC, ["this"]]]
  456. }, _UDSD);
  457. _UDKD = $$("div", {
  458. "className": "UD_SYQZOB",
  459. onclick: U.M.apply(this, [
  460. [this.use, [{ "backgroundColor": "" }, "backgroundColor"]]
  461. ])
  462. }, _UDKD);
  463. _UDLD = $$("div", {
  464. "className": "UD_SYQZI UD_SYQZZ UD_SYI UD_SYSXZBFCAHO",
  465. title: "字体色",
  466. onclick: [
  467. [U.M.StopBubble],
  468. [U.OU.ToolOC, ["this"]]
  469. ]
  470. }, _UDSD);
  471. _UDLD = $$("div", {
  472. "className": "UD_SYQZOB",
  473. onclick: U.M.apply(this, [
  474. [this.use, ([{
  475. "color": ""
  476. }, "backgroundColor"])]
  477. ])
  478. }, _UDLD);
  479. _UDED = $$("div", {
  480. "className": "UD_SYQZO UD_SYQZOV UD_SYSXZBFCAHO"
  481. }, _UDSD);
  482. _UDED = $$("select", {
  483. "className": "UD_SYQZV",
  484. onchange: U.M.apply(this, [[this.use, [{ "fontFamily": "" }, "font"]]])
  485. }, _UDED);
  486. _UDVD = $$("div", {
  487. "className": "UD_SYQZO UD_SYQZOO UD_SYSXZBFCAHO"
  488. }, _UDSD);
  489. _UDVD = $$("select", {
  490. "className": "UD_SYQZVO",
  491. onchange: U.M.apply(this, [
  492. [this.use, ([{
  493. "fontSize": ""
  494. }, "font"])]
  495. ])
  496. }, _UDVD);
  497. $$("div", {
  498. "className": "UD_SYQZI UD_SYQZLO UD_SYI UD_SYSXZBFCAHO",
  499. title: "斜体",
  500. onclick: U.M.apply(this, [
  501. [this.use, ([{
  502. fontStyle: ["italic", "normal"]
  503. }])]
  504. ])
  505. }, _UDSD);
  506. $$("div", {
  507. "className": "UD_SYQZI UD_SYQZLT UD_SYI UD_SYSXZBFCAHO",
  508. title: "加粗",
  509. onclick: U.M.apply(this, [
  510. [this.use, ([{
  511. fontWeight: ["bold", "normal"]
  512. }])]
  513. ])
  514. }, _UDSD);
  515. $$("div", {
  516. "className": "UD_SYQZI UD_SYQZF UD_SYI UD_SYSXZBFCAHO",
  517. title: "下划线",
  518. onclick: U.M.apply(this, [
  519. [this.use, ([{
  520. textDecoration: ["underline", "none"]
  521. }])]
  522. ])
  523. }, _UDSD);
  524. $$("div", {
  525. "className": "UD_SYQZI UD_SYQZT UD_SYI UD_SYSXZBFCAHO",
  526. title: "删除线",
  527. onclick: U.M.apply(this, [
  528. [this.use, ([{
  529. textDecoration: ["line-through", "none"]
  530. }])]
  531. ])
  532. }, _UDSD);
  533. $$("div", {
  534. "className": "UD_SYQZI UD_SYQLJ UD_SYI UD_SYSXZBFCAHO",
  535. title: "超链接",
  536. ///此处有问题,U.UI只能调用UC中的内容,不能调用其他文件夹地方的内容。
  537. onclick: [[U.OU.AddUrl, [U.M.apply(this, [[this.AddUrl]])]]]
  538. }, _UDSD);
  539. $$("div", {
  540. "className": "UD_SYQZI UD_SYQZR UD_SYI UD_SYSXZBFCAHO",
  541. title: "左对齐",
  542. onclick: U.M.apply(this, [
  543. [this.use, ([{
  544. textAlign: "left"
  545. }])]
  546. ])
  547. }, _UDSD);
  548. $$("div", {
  549. "className": "UD_SYQZI UD_SYQZRZ UD_SYI UD_SYSXZBFCAHO",
  550. title: "居中",
  551. onclick: U.M.apply(this, [
  552. [this.use, ([{
  553. textAlign: "center"
  554. }])]
  555. ])
  556. }, _UDSD);
  557. $$("div", {
  558. "className": "UD_SYQZI UD_SYQZRL UD_SYI UD_SYSXZBFCAHO",
  559. title: "右对齐",
  560. onclick: U.M.apply(this, [
  561. [this.use, ([{
  562. textAlign: "right"
  563. }])]
  564. ])
  565. }, _UDSD);
  566. U.OU.CreatTool([_UDED, _UDVD, _UDKD, _UDLD], [0, 1, 2, 3]);
  567. $("&*", this.head).addAttrArray({
  568. "unselectable": "on"
  569. });
  570. }
  571. _UDCD = $$("div", { "innerHTML": "在该处添加内容..." });
  572. _UCT = _UDCD.outerHTML;
  573. this.con = {
  574. className: "UD_SYSXZLRSSI UD_SYSXZBFCO",
  575. contenteditable: "true",
  576. onblur: [[U.MR.InputTip, ["this", ["<div></div>", _UCT]]]],
  577. onfocus: [[U.MR.InputTip, ["this", [_UCT]]]]
  578. };
  579. (this.car) && (U.Ut.AddObj(this.cob, this, car));
  580. this.con = _UDND = $$("div", this.con, _UDTD);
  581. _UDSD = $$("div", { className: "UD_SYSXZBFCT" }, _UDTD);
  582. // if (!this.obj.head && this.obj.upload) { //启动上传功能
  583. // // $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "width": "28px" }, "title": "添加文件",
  584. // // "onclick": [[U.Dk.HP.FileSwitch, ([US.NU, null, { "FCP": U.M.apply(this, [[this.createFile]]), "CB": U.M.apply(this, [[this.createFile]])}])]]
  585. // // }, _UDSD);
  586. // }
  587. if (this.obj.imgt) {
  588. (!U.Ut.isNumber(this.obj.imgt)) && (this.obj.imgt = 9);
  589. this.imgt = _UDBD = $$("div", {
  590. className: "UD_SYSXZLRSSVON"
  591. }, _UDSD);
  592. }
  593. _$(_USE).Each(function (UA, UB) {
  594. _USE[UB] = _UDE[UB] == null ? _USE[UB] : _UDE[UB];
  595. });
  596. U.Ut.AddObj(_USE, {
  597. SO: this.obj.parent,
  598. sizeend: U.M.apply(this, this.size),
  599. content: _UDTD,
  600. title: "<div class='UD_SYF_STI'>" + (this.obj.name || "最新发表") + "</div>"
  601. });
  602. // this.body = _UDE.parentEle ? $(_UDE.parentEle).append(_UDTD) : U.UI.Form(_USE).be;
  603. if (_UDE.parentEle) {
  604. this.body = _UDE.parentEle;
  605. $(_UDE.parentEle).append(_UDTD)
  606. }
  607. else {
  608. this.body = U.UI.Form(_USE).be;
  609. //按钮设置
  610. (this.obj.celbut !== false) && ($$("div", {
  611. className: "UD_SYSXZBFCTA UD_SYSXZBFCTAT",
  612. title: "取消",
  613. "innerHTML": "取消",
  614. "onclick": this.obj.celbut ? this.obj.celbut : [
  615. [U.D.CloseWindow, [this.body]]
  616. ]
  617. }, _UDSD));
  618. $$("div", {
  619. className: "UD_SYSXZBFCTA",
  620. title: "确定",
  621. "innerHTML": "确定",
  622. "onclick": U.M.apply(this, this.fb)
  623. }, _UDSD);
  624. }
  625. //添加flash上传控件
  626. this.objfl = U.UP.AddFAN(_UDUD, null, { "width": "25px", "height": "22px" });
  627. //flash上传的参数
  628. U.UP.FAFZ({ "width": "25px", "height": "22px" },
  629. {
  630. "ADD": U.M.apply(this, this.uadd),
  631. "CP": U.M.apply(this, this.ucp),
  632. "JDT": U.M.apply(this, this.ujdt),
  633. "FUP": U.M.apply(this, this.ufup),
  634. "FCP": U.M.apply(this, this.ufcp)
  635. }, "M"); //添加上传控件
  636. this.et[_UDE.id] = this;
  637. this.r = this.cursor(_UDTD, _UDND); //添加flash按钮
  638. }
  639. try {
  640. (U && U.D && U.D.Tb && U.D.Tb.taskbar) && (U.D.Tb.taskbar({
  641. bp: "-267px -413px",
  642. name: (_UAE.obj.name || "最新发表"),
  643. el: _UAE.body,
  644. id: _UDE.id,
  645. click: U.M.apply(_UAE, _UAE.create)
  646. }));
  647. } catch (e) { }
  648. _UAE.size();
  649. (_UDCD) && (_UAE.r.add(_UDE["context"] || _UCT));
  650. return _UAE;
  651. },
  652. text: function () {
  653. return this.con.innerHTML.escapeQuotes();
  654. },
  655. clear: function () { //清除数据
  656. var i, _UDE = this.extra;
  657. for (i = 0; i < _UDE.length; i++) {
  658. $(_UDE[i]).remove();
  659. }
  660. },
  661. append: function (UDE) { //添加
  662. var i, _UDOD = $(this.content),
  663. _UDFD = $$("frag");
  664. if (U.Ut.isArray(UDE)) {
  665. for (i = 0; i < UDE.length; i++) {
  666. this.extra.push(UDE[i]);
  667. $(_UDFD).append(UDE[i]);
  668. }
  669. } //数组添加
  670. else {
  671. _$(UDE).Each(function (UVE, UIE) {
  672. this.extra.push(U.UI.EditorLoad.addT(_UDFD, UVE, UIE));
  673. });
  674. }
  675. _UDOD.append(_UDFD, 0, _UDOD.Child()[0]); //添加
  676. },
  677. addButton: function () {
  678. },
  679. cuscreate: function () { //自定义样式 { cus:{ tr:发帖按钮, ubox :上传按钮,ti:标题区域 , con:内容区域 ,imgt :阅读查看区域 } }
  680. var _UDE = this.obj.cus;
  681. (_UDE.tr && (_UDE.tr.onclick = U.M.apply(this, this.fb), delete _UDE.tr));
  682. (_UDE.ubox) && (U.UP.AddFAN(_UDE.ubox, this.c.id, {
  683. width: "100%",
  684. height: "100%"
  685. }), U.UP.FAFZ({}, this.f, this.obj.type || "M"), delete _UDE.ubox);
  686. this.set(_UDE); //设置值使用
  687. },
  688. fb: function () { //发表文章
  689. var _UAS, _UTI, _UDTD = this.ti,
  690. _UCT = this.con.innerHTML,
  691. _UDAD = this.imgt ? $(this.imgt).Child() : null;
  692. if (_UDTD && (_UTI = _UDTD.value) && _UDTD.defaultValue == _UDTD.value) {
  693. _UAS = "请填写标题";
  694. _UDTD.focus();
  695. } //如果没有填写标题
  696. else if ((_UCT.isStrNull() || _UCT == "有什么和大家分享...") && ((_UCT = "图片分享") && (!_UDAD || !_UDAD.length))) {
  697. _UAS = "请填写内容";
  698. this.con.focus();
  699. } //内容判断
  700. else {
  701. if (this.obj.fcb && this.obj.fcb(_UCT, _UTI, _UDAD) !== true) {
  702. !this.parentEle && (this.obj.close !== false) && (U.D.CloseWindow(this.body, this.isc !== false ? "remove" : ""));
  703. } else {
  704. this.con.focus();
  705. }
  706. } //编辑框移除
  707. (_UAS) && (U.Alert(_UAS)); //成功
  708. },
  709. jd: function () { //焦点处理
  710. this.r.CreateR(); //重新记录焦点
  711. },
  712. uerror: function (UE) { //上传错误处理
  713. U.Alert("选择文件错误..");
  714. },
  715. Tool: function () { //工具隐藏处理
  716. var i, _UDTD,
  717. _UDAD = $(this.head).Child();
  718. for (i = 0; i < _UDAD.length; i++) {
  719. _UDTD = $(_UDAD[i]).Child()[0];
  720. if (_UDTD && _UDTD.tagName.toLowerCase() == "div") { $(_UDTD).css("display", "none"); }
  721. }
  722. },
  723. uadd: function (UDE, UL) { //文件上传添加
  724. var i, _UL;
  725. //图片最多上传数量处理
  726. if (this.obj.imgt) {
  727. if (this.obj.imgt - UDE.length < 0) {
  728. _UL = UDE.length - this.obj.imgt;
  729. for (i = 0; i < _UL; i++) {
  730. this.objfl.DF(UDE.length - i - 1, this.o.length);
  731. }
  732. UDE = UDE.slice(0, this.obj.imgt > UDE.length ? UDE.length : this.obj.imgt);
  733. } //超过数量
  734. this.obj.imgt -= UDE.length;
  735. }
  736. //设置文件上传的唯一识别id
  737. for (i = 0; i < UDE.length; i++) {
  738. UDE[i].id = Guid.newGuid();
  739. }
  740. //上传处理
  741. if (UL && UDE.length) {
  742. if (this.rt.add) { this.rt.add(UDE, UL) } //上传回调函数
  743. this.o.push(UDE); //添加到数组中
  744. (this.o.length == 1) && (this.up(UDE[0], 0, 0))
  745. }
  746. },
  747. up: function (UDE, UI, UJ) { //执行上传
  748. this.objfl.UpLoad(UJ, UI, (UDE || this.o[UI][UJ]).id); //执行上传
  749. },
  750. ujdt: function (UDE, UFID, UTF) { //进度条使用
  751. (this.rt.jdt) && (this.rt.jdt(UDE)); //返回进度条
  752. },
  753. ufup: (function () { //获取上传文件MD5 HASH值
  754. var asyn = function (r) {
  755. var context = r.context,
  756. _UDE = context[1],
  757. _UFID = context[2];
  758. r = r.value;
  759. if (r) {
  760. this.ufcp(r, _UFID);
  761. }
  762. else if ((!this.rt.fup) || (this.rt.fup(_UDE) !== false)) {
  763. 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]);
  764. }
  765. },
  766. _ = function (UWE, UFID) {
  767. var _UDE = this.getup(UFID);
  768. if (_UDE[0]) {
  769. U.A.Request(US.Auth, ["GetFileByHash", UWE, _UDE[0].size, _UDE[0].type.substr(1)], U.M.apply(this, asyn), (["", _UDE, UFID]));
  770. }
  771. else {
  772. this.ufcp(null, UFID)
  773. }
  774. }
  775. return _;
  776. })(),
  777. ucp: function (UDE) { //单个文件上传完毕
  778. },
  779. ufcp: function (UDE, UFID) { //获取返回值
  780. this.del(null, UFID); //上传成功后移除
  781. if (UDE && (!this.rt.fcp || this.rt.fcp(UDE, _UCE))) {
  782. (UDE.data) && ((UDE = U.M.toList(UDE.data)), UDE = {
  783. UserFilesServerName: UDE[0],
  784. UseFilesServerThumbnailName: UDE[1],
  785. UserFilesID: UDE[2],
  786. UserFilesSize: UDE[3],
  787. UserDirectoryEncrypt: UDE[4]
  788. });
  789. //服务器返回值处理
  790. if (UDE.data) {
  791. UDE = U.M.toList(UDE.data); //转化成json处理
  792. //服务器返回的
  793. UDE = {
  794. UserFilesServerName: UDE[0],
  795. UseFilesServerThumbnailName: UDE[1],
  796. UserFilesID: UDE[2],
  797. UserFilesSize: UDE[3],
  798. UserDirectoryEncrypt: UDE[4]
  799. }
  800. }
  801. //通过左下角追加崔丽
  802. if (this.imgt) {
  803. $$("img", {
  804. onerror: "U.M.ImgError(this, 2)",
  805. title: "右键删除",
  806. src: U.M.GetImgU(UDE.UserFilesServerName),
  807. alt: U.M.GetImgU(UDE.UserFilesServerName),
  808. onmouseup: U.M.apply(this, [
  809. [this.imgdel, ["this"]]
  810. ]),
  811. onclick: [
  812. [U.D.Img.Img, ([null, {
  813. UserFilesServerName: UDE.UserFilesServerName,
  814. UseFilesServerThumbnailName: UDE.UseFilesServerThumbnailName
  815. }])]
  816. ]
  817. }, this.imgt);
  818. }
  819. else { this.createFile(null, null, null, UDE); } //写入文件
  820. }
  821. (_UGE.length) && (this.up(null, 0, 0)); //成功上传后继续上传
  822. },
  823. createFile: function (URL, USN, UDOD, UDE) {
  824. var _UDOD, _UDTD, _UDSD, _UDMD, _UTH, _UGE = this.o;
  825. if (U.UP.IsImg(UDE.UserFilesServerName)) {
  826. _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='点击查看原图' /> &nbsp</span>"
  827. }
  828. else { //普通文件处理
  829. _UDOD = $$("div", {
  830. contenteditable: "false",
  831. style: {
  832. "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"
  833. }
  834. });
  835. _UDTD = $$("div", {
  836. className: "UD_SYID",
  837. "style": {
  838. "cssText": "margin:10px 0 0 10px; width:40px; height:50px; margin:15px 0 0 10px; float:left; background-position:-261px -22px"
  839. }
  840. }, _UDOD);
  841. $$("div", {
  842. style: {
  843. cssText: "font-size:15px; width:40px; margin:auto; font-family:'微软雅黑'; text-align:center; color:#888; position:relative; top:16px; height:20px; overflow:hidden;"
  844. },
  845. innerHTML: U.UP.GetUpName(UDE.UserFilesServerName)[1]
  846. }, _UDTD);
  847. _UDTD = $$("div", {
  848. style: {
  849. "cssText": "width:195px; height:100%; margin-left:10px; float:left;"
  850. }
  851. }, _UDOD);
  852. _UDSD = $$("div", {
  853. style: {
  854. "cssText": "width:200px; height:35px; line-height:35px;"
  855. }
  856. }, _UDTD);
  857. _UDMD = $$("div", {
  858. innerHTML: "文档 容量大小 "
  859. }, _UDSD);
  860. $$("span", {
  861. innerHTML: U.UP.FileSize(UDE.UserFilesSize),
  862. style: {
  863. cssText: "color:#006699;"
  864. }
  865. }, _UDMD);
  866. _UDSD = $$("div", {
  867. style: {
  868. "cssText": "width:200px; height:35px; line-height:35px;"
  869. }
  870. }, _UDTD);
  871. _UDMD = $$("div", {
  872. style: {
  873. "cssText": "float:left; width:35px; height:35px;"
  874. }
  875. }, _UDSD);
  876. $$("img", {
  877. style: {
  878. "cssText": "width:30px; height:30px;"
  879. },
  880. src: U.M.GetImgU(US.userInfo.UserThumbnailImageHead)
  881. }, _UDMD);
  882. $$("div", {
  883. style: {
  884. "cssText": "float:left;padding:0 8px;max-width:50px;"
  885. },
  886. innerHTML: US.userInfo.username
  887. }, _UDSD);
  888. $$("a", {
  889. innerHTML: "点击下载",
  890. href: "/userpages/UD_XZ.htm?id=" + UDE.UserFilesID + "&type=file",
  891. target: "_blank"
  892. }, _UDSD);
  893. $("*", _UDOD).addAttrArray({
  894. contenteditable: "false"
  895. });
  896. _UTH = " &nbsp" + _UDOD.outerHTML + "&nbsp ";
  897. }
  898. this.r.add(_UTH);
  899. },
  900. AddUrl: function (URL) {
  901. URL = URL.value;
  902. this.r.add("<a href='" + URL + "' style='color:#3B639F;text-decoration:none;' target='_blank' >" + (URL) + "</a>");
  903. },
  904. imgdel: function (UDOD) { //图片删除
  905. if (event.button == 2) {
  906. this.obj.imgt++;
  907. $(UDOD).remove();
  908. }
  909. },
  910. uacp: function () { //所有文件上传完毕
  911. try {
  912. (!this.rt.acp) && (this.rt.acp());
  913. } catch (e) { }
  914. this.objfl.DAF();
  915. },
  916. del: function (UIE, UFID) { //删除上传后的实体
  917. var _UDE, UJ, _UGE = this.o;
  918. if (UIE != null) {
  919. _UGE.splice(UIE, 1);
  920. } else if (UFID) {
  921. _UDE = this.getup(UFID);
  922. (_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)));
  923. } //删除上传实体
  924. (!_UGE.length) && (this.uacp()); //所有的上传完毕
  925. },
  926. getup: function (UDID) { //获取上传文件实体
  927. var i, j, _UDE = this.o;
  928. for (i = 0; i < _UDE.length; i++) {
  929. for (j = 0; j < _UDE[i].length; j++) {
  930. if (_UDE[i][j].id == UDID) {
  931. return [_UDE[i][j], i, j];
  932. }
  933. }
  934. }
  935. return [null, -1, -1];
  936. },
  937. size: function () { //大小变化
  938. $(this.content).css("height", $(this.content).parentg().height() - 2 + "px");
  939. $(this.con).css("height", this.content.offsetHeight - (this.ti ? 115 : 70) - (this.head ? 33 : 0) - 1 + "px");
  940. },
  941. use: function (UDE, UTF) { //功能使用
  942. if (UTF) {
  943. var i, _UDOD = event.srcElement;
  944. for (i in UDE) {
  945. UDE[i] = UTF == "font" ? _UDOD.value + (i == "fontSize" ? "px" : "") : _UDOD.style[UTF];
  946. }
  947. }
  948. this.r.use(UDE);
  949. },
  950. cursor: (function () { //光标处理
  951. var _UDE, _ = function (UDOD, UDTD) {
  952. return new _UDE.init(UDOD, UDTD).bind();
  953. }
  954. _.prototype = _UDE = {
  955. init: function (UDOD, UDTD) { //初始化变量
  956. var _UDID = Guid.guidNoDash();
  957. U.Ut.AddObj(this, {
  958. iso: false,
  959. isb: false,
  960. el: UDOD,
  961. eb: UDTD,
  962. id: _UDID,
  963. sor: U.D.E.GetSelectionRange(window, UDTD, {
  964. "TF": _UDID
  965. })
  966. });
  967. },
  968. bind: function () { //事件绑定
  969. $(this.el).bind({
  970. mousedown: U.M.apply(this, this.create)
  971. });
  972. $(this.eb).bind({
  973. blur: U.M.apply(this, this.blur),
  974. focus: U.M.apply(this, this.focus)
  975. });
  976. return this; //失去焦点使用
  977. },
  978. blur: function () { //失去焦点使用
  979. if (!this.iso) {
  980. var _UDE = U.D.E.SORange.OAT[this.id],
  981. _UL = _UDE.length > 2 ? _UDE.length - 2 : _UDE.length - 1;
  982. this.sor = _UDE.length > 1 ? _UDE[_UDE.length - 2].OR : this.sor;
  983. }
  984. this.isb = true;
  985. },
  986. focus: function () { //聚焦使用
  987. this.isb = false;
  988. },
  989. create: function () { //重新添加光标位置
  990. var _UDOD = this.eb,
  991. _UDTD = event ? event.srcElement : null;
  992. this.iso = false;
  993. ((!_UDTD || (_UDOD !== _UDTD && !U.M.EISE(_UDOD, _UDTD)) && !this.isb)) && (this.sor.CreateR(), this.iso = true);
  994. },
  995. add: function (UST) { //写入内容
  996. this.eb.focus();
  997. this.sor.Replace(UST, null, true);
  998. this.sor.CreateR();
  999. },
  1000. use: function (UDE) { //功能调用使用
  1001. U.D.E.FontSizeType(this.sor.Parent(), UDE, this.sor, this.id);
  1002. }
  1003. }
  1004. _UDE.init.prototype = _UDE;
  1005. return _;
  1006. })(),
  1007. //插入表情包
  1008. face: function (UDOD, UIE) {
  1009. var _UIMG = "/img/ChatingFaceGif/[face](" + UIE + ").gif";
  1010. //$("#UF_FBD")[0].style.display = "none";
  1011. this.r.add(" " + $$("img", { "src": _UIMG, "contentEditable": "true" }).outerHTML + " "); //插入表情包
  1012. }
  1013. }
  1014. //#endregion
  1015. //表情包
  1016. /**
  1017. * 弹出表情框 对应表情框图片 /img/face.gif
  1018. *
  1019. */
  1020. U.UI.face = function (UDOD, UCB) {
  1021. var i, _UDTD,
  1022. _UDOD = $("#UF_FBD")[0];
  1023. if (_UDOD) {
  1024. $("#UF_FBD")[0].style.display = $("#UF_FBD")[0].style.display == "none" ? "block" : "none";
  1025. }
  1026. else {
  1027. _UDOD = $$("div", { "id": "UF_FBD", "class": "UF_FBD", "onmousedown": U.M.StopBubble }, UDOD);
  1028. _UDTD = $$("div", { "class": "UF_FNR" }, _UDOD);
  1029. for (i = 0; i <= 104; i++) {//循环表 情按钮
  1030. $$("div", { "className": "UF_FDG", "onclick": [UCB ? [UCB, [_UDOD, i]] : null] }, _UDTD);
  1031. }
  1032. }
  1033. }
  1034. //#region 对话框
  1035. /**
  1036. * 创建对话框
  1037. * @returns {function} 回调函数初始化
  1038. * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
  1039. */
  1040. U.UI.Confirm = function () {
  1041. return new U.UI.Confirm.init(arguments);
  1042. }
  1043. /**
  1044. * 初始化对话框实例
  1045. * @returns {function} 回调函数初始化
  1046. * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
  1047. */
  1048. U.UI.Confirm.init = function (UDE) {
  1049. var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "top"];
  1050. if (UDE.length < 4) {
  1051. var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
  1052. UDE = ["消息提示", { "width": "300px" }, UDE[2], UDE[1],
  1053. $$("div", {
  1054. "className": "U_UI_OC",
  1055. "style": {
  1056. "textAlign": "center",
  1057. "margin": "25px 0",
  1058. "max-width": "400px",
  1059. "word-wrap": "break-word",
  1060. "max-height": "400px",
  1061. "overflow": "auto"
  1062. },
  1063. innerHTML: UDE[0] ? UDE[0] : ""
  1064. })];
  1065. }
  1066. for (i = 0; i < UDE.length; i++) {
  1067. this[_UCE[i]] = UDE[i];
  1068. }
  1069. this.Create();
  1070. }
  1071. U.UI.Confirm.init.prototype = {
  1072. /**
  1073. * 创建对话框的ui
  1074. */
  1075. Create: function () {
  1076. var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
  1077. width: "auto",
  1078. height: "auto"
  1079. },
  1080. _UEK = (this.style = this.style || {});
  1081. _$(_USE).Each(function (UA, UB) {
  1082. _UEK[UB] = _UEK[UB] || UA;
  1083. });
  1084. _UEK.zIndex = 9999;
  1085. var _frag = $$("frag");
  1086. _UDOD = $$("div", { "className": "U_UI_OB" });
  1087. _UDTD = $$("div", { "className": "U_UI_OBA" }, _UDOD);
  1088. this.No = $$("div", {
  1089. "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]]))]],
  1090. "innerHTML": "取消",
  1091. "style": { "display": this.Q == true ? "none" : "block" },
  1092. "className": "U_UI_OBY"
  1093. }, _UDTD);
  1094. this.Yes = _UDSD = $$("div", {
  1095. "onclick": U.M.apply(this, [[this.confirmYesNo, [this.confirmYesClose]]]), //[(U.Ut.isArray(this.confirmYesClose) ? this.confirmYesClose : [this.confirmYesClose]), [_UCB]],
  1096. "innerHTML": "确定",
  1097. "className": "U_UI_OBY"
  1098. }, _UDTD); //确定按钮
  1099. _frag.appendChild(this.content);
  1100. _frag.appendChild(_UDOD);
  1101. this.form = _UDE = U.UI.Form({
  1102. id: "U_COF",
  1103. top: this.top ? true : false,
  1104. min: false,
  1105. max: false,
  1106. style: this.style,
  1107. title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
  1108. content: _frag,
  1109. hst: {
  1110. style: {
  1111. padding: "0"
  1112. }
  1113. },
  1114. draw: false
  1115. }); //创建对话框
  1116. // $(_UDE.body).append(_UDOD);
  1117. _UDID = $("input", _UDE.body);
  1118. for (i = _UDID.length - 1; i >= 0; i--) {
  1119. if ("text,password".indexOf(_UDID[i].type) > -1) {
  1120. _UDID[i].focus();
  1121. _UDID[i].onkeypress = U.M.apply(_UDID[i], [
  1122. [U.M.returnkeylogin, ([
  1123. [{
  1124. "obj": _UDSD,
  1125. "event": 'onclick'
  1126. }]
  1127. ])]
  1128. ]);
  1129. }
  1130. }
  1131. return _UDE;
  1132. },
  1133. /**
  1134. * 给对话框设置事件
  1135. * @param {object} 窗体事件使用
  1136. ----------[yes] {function} 确定的函数事件
  1137. ----------[no] {function} 取消的函数事件
  1138. */
  1139. AddEvent: function (UDE) {
  1140. for (var i in UDE) {
  1141. if (UDE.hasOwnProperty(i)) {
  1142. this[i].onclick = U.M.apply(this.form, [[this.form.shut], UDE[i]]); //
  1143. }
  1144. }
  1145. },
  1146. /**
  1147. * 给对话框设置事件
  1148. * @param {object} 窗体事件使用
  1149. */
  1150. confirmYesNo: function (UFN) {
  1151. var _UCB = U.M.apply(this.form, [[this.form.shut]]), //关闭窗体的函数
  1152. _UTF = U.Ut.isArray(UFN) ? U.M.apply(this, [UFN])() : (UFN) && (UFN.call(this));
  1153. if (_UTF !== false) { //不允许关闭
  1154. _UCB();
  1155. }
  1156. // [(U.Ut.isArray(this.confirmNoClose) ? this.confirmNoClose : [this.confirmNoClose]), [(_UCB = U.M.apply(_UDE, [[_UDE.shut]]))]]
  1157. }
  1158. }
  1159. /*U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
  1160. (!UDW || !UDH) && (UDW = "400px", UDH = "550px");
  1161. return U.UI.From({
  1162. id: UDID ? UDID : null,
  1163. style: { "width": parseInt(UDW) + "px", "height": parseInt(UDH) + "px" },
  1164. content: UDC ? UDC : null, title: UDT ? UDT : "通知",
  1165. min: false,
  1166. max: false,
  1167. draw: false
  1168. });
  1169. }*/
  1170. //U.UI.Confirm = function (UCT, UCBF, UCNF) {
  1171. // var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
  1172. // if (_UDOD[0]) { //判断是否有U_COF的子节点,没有则创建
  1173. // _UDOD.childg(0, 1).childg(0, 0).html(UCT); //设置内容
  1174. // _UDOD.Center(); //内容居中
  1175. // } else {
  1176. // $(U.UI.Dialog("消息提示", {}, UCNF ? U.M.apply(this, [UCNF]) : null, UCBF ? U.M.apply(this, [UCBF]) : null,
  1177. // $$("div", {
  1178. // "className": "U_UI_OC",
  1179. // "style": {
  1180. // "textAlign": "center",
  1181. // "padding": "25px 0 25px 0"
  1182. // },
  1183. // innerHTML: UCT
  1184. // })).Create()).addAttrArray({
  1185. // "id": "U_COF"
  1186. // })[0];
  1187. // U.M.StopBubble(); //阻止冒泡
  1188. // return _UDOD;
  1189. //}
  1190. /**
  1191. * 创建一个通知形式的对话框
  1192. *{str} UDC 对话框里面的内容。
  1193. *{str} UDT 标题
  1194. *{str} UDID 对话框id
  1195. *{int} UDW 宽度
  1196. *{int} UDH 高度
  1197. * @returns 返回ID为U_COF的对象
  1198. **/
  1199. U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
  1200. return new U.UI.Dialog.init(arguments);
  1201. }
  1202. U.M.Setprototype(U.UI.Dialog, U.Ut.AddObj(U.UI.Dialog, {
  1203. init: function (UDE) { //添加对话框信息
  1204. var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "SO"];
  1205. for (i = 0; i < UDE.length; i++) {
  1206. this[_UCE[i]] = UDE[i];
  1207. }
  1208. },
  1209. Create: function () { //创建对话框
  1210. var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
  1211. width: "auto",
  1212. height: "auto",
  1213. minWidth: "300px"
  1214. },
  1215. _UEK = (this.style = this.style || {});
  1216. _$(_USE).Each(function (UA, UB) {
  1217. _UEK[UB] = _UEK[UB] || UA;
  1218. });
  1219. _UEK.zIndex = 9999;
  1220. _UDE = U.UI.Form({
  1221. top: true,
  1222. min: false,
  1223. max: false,
  1224. style: this.style,
  1225. title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
  1226. content: this.content,
  1227. hst: {
  1228. style: {
  1229. padding: "0"
  1230. }
  1231. }
  1232. }); //创建对话框
  1233. _UDOD = $$("div", {
  1234. "className": "U_UI_OB"
  1235. });
  1236. _UDTD = $$("div", {
  1237. "className": "U_UI_OBA"
  1238. }, _UDOD);
  1239. $$("div", {
  1240. "onclick": [
  1241. [this.confirmNoClose],
  1242. [(_UCB = U.M.apply(_UDE, [
  1243. [_UDE.close]
  1244. ]))]
  1245. ],
  1246. "innerHTML": "取消",
  1247. "className": "U_UI_OBY"
  1248. }, _UDTD);
  1249. _UDSD = $$("div", {
  1250. "onclick": [
  1251. [this.confirmYesClose],
  1252. [_UCB]
  1253. ],
  1254. "innerHTML": "确定",
  1255. "className": "U_UI_OBY"
  1256. }, _UDTD); //确定按钮
  1257. $(_UDE.body).append(_UDOD);
  1258. _UDID = $("input", _UDE.body);
  1259. for (i = _UDID.length - 1; i >= 0; i--) {
  1260. if ("text,password".indexOf(_UDID[i].type) > -1) {
  1261. _UDID[i].focus();
  1262. _UDID[i].onkeypress = U.M.apply(_UDID[i], [
  1263. [U.M.returnkeylogin, ([
  1264. [{
  1265. "obj": _UDSD,
  1266. "event": 'onclick'
  1267. }]
  1268. ])]
  1269. ]);
  1270. }
  1271. }
  1272. }
  1273. }));
  1274. U.UI.Dialog.init.prototype = U.UI.Dialog.prototype;
  1275. //#endregion
  1276. //#region RadioList
  1277. U.M.Setprototype(U.UI.RadioList, U.Ut.AddObj(U.UI.RadioList, {
  1278. init: function (UDOD, UDE, UCB) {
  1279. this.UDTD;
  1280. this.UDE = UDE;
  1281. this.UDOD = UDOD;
  1282. this.UCB = UCB;
  1283. this.create(UDOD);
  1284. }, //生成RadioList
  1285. create: function (UDOD) {
  1286. var i, _UDTD, _UDE = this.UDE,
  1287. _UN = Guid.guidNoDash(),
  1288. _UDFD = $$("frag");
  1289. if (_UDE) {
  1290. UDOD.innerText = "";
  1291. for (i in UDE) {
  1292. if (UDE.hasOwnProperty(i)) {
  1293. _UDTD = $$("div", {
  1294. "innerHTML": UDE[i],
  1295. "style": {
  1296. "cssText": "margin-left:5px;"
  1297. }
  1298. }, _UDFD);
  1299. _UDTD = $$("input", {
  1300. "type": "radio",
  1301. "value": i,
  1302. "name": _UN,
  1303. "checked": i ? false : true,
  1304. "onclick": U.M.apply(this, this.chang)
  1305. }, _UDTD);
  1306. (!i) && (this.UDTD = _UDTD);
  1307. }
  1308. }
  1309. UDOD.appendChild(_UDFD);
  1310. } else {
  1311. _UDTD = $("input[type='radio']", UDOD).addAttrArray({
  1312. "name": _UN,
  1313. "onclick": U.M.apply(this, this.chang)
  1314. });
  1315. for (i = 0; i < _UDTD.length; i++) {
  1316. if (_UDTD[i].checked) {
  1317. this.UDTD = _UDTD[i];
  1318. break;
  1319. }
  1320. }
  1321. } //设置相同的name
  1322. },
  1323. value: function () {
  1324. return this.UDTD.value;
  1325. }, //当前聚焦元素的值
  1326. element: function () {
  1327. return this.UDTD;
  1328. }, //当前聚焦元素
  1329. chang: function () {
  1330. var _UDOD = event.srcElement;
  1331. (_UDOD != this.UDTD) && (this.UDTD = _UDOD, (this.UCB) && (this.UCB(_UDOD)));
  1332. } //改变事件
  1333. }));
  1334. U.UI.RadioList.init.prototype = U.UI.RadioList.prototype;
  1335. //#endregion
  1336. //#region alert
  1337. /*
  1338. 弹出提示框,为了同时弹出多个提示框,为多份实例对象
  1339. 1、可以像java语言的用法,用new调用多份,例如: var a=new U.AlertB();
  1340. 2、也可以省略new的步骤,直接U.Alert(),出来的结果为多份。
  1341. 参数一:UTH 内容
  1342. 参数二:UTI 无确认按钮的显示时间
  1343. 参数三:是否带确认按钮
  1344. 返回值:
  1345. */
  1346. U.Alert = function (UTH, UTI, IFQ) {
  1347. IFQ === true ? new U.AlertA(UTH, IFQ) : new U.AlertB(UTH, UTI);
  1348. }
  1349. //为了多份实例,另外建立一个类似类的函数。
  1350. //带有确定按钮的alert
  1351. U.AlertA = function (UTH) {
  1352. U.UI.Confirm("提示框", {}, null, null, $$("div", {
  1353. "style": {
  1354. "textAlign": "center",
  1355. "margin": "25px 10px 25px 10px",
  1356. "max-width": "400px",
  1357. "word-wrap": "break-word",
  1358. "max-height": "400px",
  1359. "overflow": "auto"
  1360. },
  1361. innerHTML: UTH
  1362. }), true);
  1363. }
  1364. //自动消失的alert
  1365. U.AlertB = function (UTH, UTI) {
  1366. this.TI = ((UTI == null || UTI < 0) ? 1000 : UTI);
  1367. var _UDPD = $("body")[0];
  1368. this.UDOD = $($$("div", {
  1369. "innerHTML": UTH,
  1370. "className": "USalert",
  1371. "style": { "cssText": "z-index:9999;left:" + ((US.Width / 2 - 160) + _UDPD.scrollLeft) + "px;top:" + ((US.Height / 2 - 100) + _UDPD.scrollTop) + "px" },
  1372. "onclick": U.M.apply(this, [[this.DAlert, [true]]])
  1373. }, $("body")[0])).animate({
  1374. "top": US.Height / 2 - 80 + _UDPD.scrollTop + "px"
  1375. }, 300, U.M.apply(this, this.AsynAmAlert));
  1376. }
  1377. //为了减少内存消耗,把方法写在原型中。
  1378. U.AlertB.prototype = {
  1379. // init: function (UTH, UTI) {//创建alert "id": "USalert",
  1380. // 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));
  1381. // },
  1382. AsynAmAlert: function () { //等待动画
  1383. this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
  1384. },
  1385. AmAlert: function () { //结束动画
  1386. (this.UTI) && (clearTimeout(this.UTI));
  1387. var _UDOD = $(this.UDOD);
  1388. (_UDOD.Parent() == document.body) && (_UDOD.animate({
  1389. "top": _UDOD[0].offsetTop - 70 + "px"
  1390. }, 100, U.M.apply(this, this.DAlert)));
  1391. },
  1392. DAlert: function (UTF) { //移除alert
  1393. if (this.TI || UTF) {
  1394. $(this.UDOD).remove();
  1395. }
  1396. }
  1397. }
  1398. //U.M.Setprototype(U.AlertB, {
  1399. // // init: function (UTH, UTI) {//创建alert "id": "USalert",
  1400. // // 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));
  1401. // // },
  1402. // AsynAmAlert: function () {//等待动画
  1403. // this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
  1404. // },
  1405. // AmAlert: function () {//结束动画
  1406. // (this.UTI) && (clearTimeout(this.UTI)); var _UDOD = $(this.UDOD);
  1407. // (_UDOD.Parent() == document.body) && (_UDOD.animate({ "top": US.Height / 2 - 70 + "px" }, 100, U.M.apply(this, this.DAlert)));
  1408. // },
  1409. // DAlert: function (UTF) { //移除alert
  1410. // if (this.TI || UTF) { $(this.UDOD).remove(); }
  1411. // }
  1412. //}); //U.Ut.AddObj(U.Alert,})
  1413. //U.Alert.prototype.init.prototype = U.Alert.prototype;
  1414. //#endregion