U.UI.js 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522
  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", { "className": "UD_SYFDTW UD_SYI UD_SYSXZBFCAHH", "style": { "width": "28px" }, "title": "网盘添加文件",
  443. "onclick": [[U.Dk.VW.CCWPXZK, ([US.NU, { "onclick": U.M.apply(this, [[this.createFile]]) }, null])]]
  444. }, _UDSD);
  445. }
  446. _UDKD = $$("div", {
  447. "className": "UD_SYQZI UD_SYQCT UD_SYI UD_SYSXZBFCAHO",
  448. title: "表情包",
  449. onclick: [[U.M.StopBubble], [U.UI.face, ["this", U.M.apply(this, this.face)]]]
  450. }, _UDSD);
  451. _UDKD = $$("div", {
  452. "className": "UD_SYQZI UD_SYQZJ UD_SYI UD_SYSXZBFCAHO",
  453. title: "背景色",
  454. onclick: [[U.M.StopBubble], [U.OU.ToolOC, ["this"]]]
  455. }, _UDSD);
  456. _UDKD = $$("div", {
  457. "className": "UD_SYQZOB",
  458. onclick: U.M.apply(this, [
  459. [this.use, [{ "backgroundColor": "" }, "backgroundColor"]]
  460. ])
  461. }, _UDKD);
  462. _UDLD = $$("div", {
  463. "className": "UD_SYQZI UD_SYQZZ UD_SYI UD_SYSXZBFCAHO",
  464. title: "字体色",
  465. onclick: [
  466. [U.M.StopBubble],
  467. [U.OU.ToolOC, ["this"]]
  468. ]
  469. }, _UDSD);
  470. _UDLD = $$("div", {
  471. "className": "UD_SYQZOB",
  472. onclick: U.M.apply(this, [
  473. [this.use, ([{
  474. "color": ""
  475. }, "backgroundColor"])]
  476. ])
  477. }, _UDLD);
  478. _UDED = $$("div", {
  479. "className": "UD_SYQZO UD_SYQZOV UD_SYSXZBFCAHO"
  480. }, _UDSD);
  481. _UDED = $$("select", {
  482. "className": "UD_SYQZV",
  483. onchange: U.M.apply(this, [[this.use, [{ "fontFamily": "" }, "font"]]])
  484. }, _UDED);
  485. _UDVD = $$("div", {
  486. "className": "UD_SYQZO UD_SYQZOO UD_SYSXZBFCAHO"
  487. }, _UDSD);
  488. _UDVD = $$("select", {
  489. "className": "UD_SYQZVO",
  490. onchange: U.M.apply(this, [
  491. [this.use, ([{
  492. "fontSize": ""
  493. }, "font"])]
  494. ])
  495. }, _UDVD);
  496. $$("div", {
  497. "className": "UD_SYQZI UD_SYQZLO UD_SYI UD_SYSXZBFCAHO",
  498. title: "斜体",
  499. onclick: U.M.apply(this, [
  500. [this.use, ([{
  501. fontStyle: ["italic", "normal"]
  502. }])]
  503. ])
  504. }, _UDSD);
  505. $$("div", {
  506. "className": "UD_SYQZI UD_SYQZLT UD_SYI UD_SYSXZBFCAHO",
  507. title: "加粗",
  508. onclick: U.M.apply(this, [
  509. [this.use, ([{
  510. fontWeight: ["bold", "normal"]
  511. }])]
  512. ])
  513. }, _UDSD);
  514. $$("div", {
  515. "className": "UD_SYQZI UD_SYQZF UD_SYI UD_SYSXZBFCAHO",
  516. title: "下划线",
  517. onclick: U.M.apply(this, [
  518. [this.use, ([{
  519. textDecoration: ["underline", "none"]
  520. }])]
  521. ])
  522. }, _UDSD);
  523. $$("div", {
  524. "className": "UD_SYQZI UD_SYQZT UD_SYI UD_SYSXZBFCAHO",
  525. title: "删除线",
  526. onclick: U.M.apply(this, [
  527. [this.use, ([{
  528. textDecoration: ["line-through", "none"]
  529. }])]
  530. ])
  531. }, _UDSD);
  532. $$("div", {
  533. "className": "UD_SYQZI UD_SYQLJ UD_SYI UD_SYSXZBFCAHO",
  534. title: "超链接",
  535. ///此处有问题,U.UI只能调用UC中的内容,不能调用其他文件夹地方的内容。
  536. onclick: [[U.OU.AddUrl, [U.M.apply(this, [[this.AddUrl]])]]]
  537. }, _UDSD);
  538. $$("div", {
  539. "className": "UD_SYQZI UD_SYQZR UD_SYI UD_SYSXZBFCAHO",
  540. title: "左对齐",
  541. onclick: U.M.apply(this, [
  542. [this.use, ([{
  543. textAlign: "left"
  544. }])]
  545. ])
  546. }, _UDSD);
  547. $$("div", {
  548. "className": "UD_SYQZI UD_SYQZRZ UD_SYI UD_SYSXZBFCAHO",
  549. title: "居中",
  550. onclick: U.M.apply(this, [
  551. [this.use, ([{
  552. textAlign: "center"
  553. }])]
  554. ])
  555. }, _UDSD);
  556. $$("div", {
  557. "className": "UD_SYQZI UD_SYQZRL UD_SYI UD_SYSXZBFCAHO",
  558. title: "右对齐",
  559. onclick: U.M.apply(this, [
  560. [this.use, ([{
  561. textAlign: "right"
  562. }])]
  563. ])
  564. }, _UDSD);
  565. U.OU.CreatTool([_UDED, _UDVD, _UDKD, _UDLD], [0, 1, 2, 3]);
  566. $("&*", this.head).addAttrArray({
  567. "unselectable": "on"
  568. });
  569. }
  570. _UDCD = $$("div", { "innerHTML": "在该处添加内容..." });
  571. _UCT = _UDCD.outerHTML;
  572. this.con = {
  573. className: "UD_SYSXZLRSSI UD_SYSXZBFCO",
  574. contenteditable: "true",
  575. onblur: [[U.MR.InputTip, ["this", ["<div></div>", _UCT]]]],
  576. onfocus: [[U.MR.InputTip, ["this", [_UCT]]]]
  577. };
  578. (this.car) && (U.Ut.AddObj(this.cob, this, car));
  579. this.con = _UDND = $$("div", this.con, _UDTD);
  580. _UDSD = $$("div", { className: "UD_SYSXZBFCT" }, _UDTD);
  581. // if (!this.obj.head && this.obj.upload) { //启动上传功能
  582. // // $$("div", { "className": "UD_SYFDTZ UD_SYI UD_SYSXZBFCAHO", "style": { "width": "28px" }, "title": "添加文件",
  583. // // "onclick": [[U.Dk.HP.FileSwitch, ([US.NU, null, { "FCP": U.M.apply(this, [[this.createFile]]), "CB": U.M.apply(this, [[this.createFile]])}])]]
  584. // // }, _UDSD);
  585. // }
  586. if (this.obj.imgt) {
  587. (!U.Ut.isNumber(this.obj.imgt)) && (this.obj.imgt = 9);
  588. this.imgt = _UDBD = $$("div", {
  589. className: "UD_SYSXZLRSSVON"
  590. }, _UDSD);
  591. }
  592. _$(_USE).Each(function (UA, UB) {
  593. _USE[UB] = _UDE[UB] == null ? _USE[UB] : _UDE[UB];
  594. });
  595. U.Ut.AddObj(_USE, {
  596. SO: this.obj.parent,
  597. sizeend: U.M.apply(this, this.size),
  598. content: _UDTD,
  599. title: "<div class='UD_SYF_STI'>" + (this.obj.name || "最新发表") + "</div>"
  600. });
  601. // this.body = _UDE.parentEle ? $(_UDE.parentEle).append(_UDTD) : U.UI.Form(_USE).be;
  602. if (_UDE.parentEle) {
  603. this.body = _UDE.parentEle;
  604. $(_UDE.parentEle).append(_UDTD)
  605. }
  606. else {
  607. this.body = U.UI.Form(_USE).be;
  608. //按钮设置
  609. (this.obj.celbut !== false) && ($$("div", {
  610. className: "UD_SYSXZBFCTA UD_SYSXZBFCTAT",
  611. title: "取消",
  612. "innerHTML": "取消",
  613. "onclick": this.obj.celbut ? this.obj.celbut : [
  614. [U.D.CloseWindow, [this.body]]
  615. ]
  616. }, _UDSD));
  617. $$("div", {
  618. className: "UD_SYSXZBFCTA",
  619. title: "确定",
  620. "innerHTML": "确定",
  621. "onclick": U.M.apply(this, this.fb)
  622. }, _UDSD);
  623. }
  624. //添加flash上传控件
  625. this.objfl = U.UP.AddFAN(_UDUD, null, { "width": "25px", "height": "22px" });
  626. //flash上传的参数
  627. U.UP.FAFZ({ "width": "25px", "height": "22px" },
  628. { "ADD": U.M.apply(this, this.uadd),
  629. "CP": U.M.apply(this, this.ucp),
  630. "JDT": U.M.apply(this, this.ujdt),
  631. "FUP": U.M.apply(this, this.ufup),
  632. "FCP": U.M.apply(this, this.ufcp)
  633. }, "M"); //添加上传控件
  634. this.et[_UDE.id] = this;
  635. this.r = this.cursor(_UDTD, _UDND); //添加flash按钮
  636. }
  637. try {
  638. (U && U.D && U.D.Tb && U.D.Tb.taskbar) && (U.D.Tb.taskbar({
  639. bp: "-267px -413px",
  640. name: (_UAE.obj.name || "最新发表"),
  641. el: _UAE.body,
  642. id: _UDE.id,
  643. click: U.M.apply(_UAE, _UAE.create)
  644. }));
  645. } catch (e) { }
  646. _UAE.size();
  647. (_UDCD) && (_UAE.r.add(_UDE["context"] || _UCT));
  648. return _UAE;
  649. },
  650. text: function () {
  651. return this.con.innerHTML.escapeQuotes();
  652. },
  653. clear: function () { //清除数据
  654. var i, _UDE = this.extra;
  655. for (i = 0; i < _UDE.length; i++) {
  656. $(_UDE[i]).remove();
  657. }
  658. },
  659. append: function (UDE) { //添加
  660. var i, _UDOD = $(this.content),
  661. _UDFD = $$("frag");
  662. if (U.Ut.isArray(UDE)) {
  663. for (i = 0; i < UDE.length; i++) {
  664. this.extra.push(UDE[i]);
  665. $(_UDFD).append(UDE[i]);
  666. }
  667. } //数组添加
  668. else {
  669. _$(UDE).Each(function (UVE, UIE) {
  670. this.extra.push(U.UI.EditorLoad.addT(_UDFD, UVE, UIE));
  671. });
  672. }
  673. _UDOD.append(_UDFD, 0, _UDOD.Child()[0]); //添加
  674. },
  675. addButton: function () {
  676. },
  677. cuscreate: function () { //自定义样式 { cus:{ tr:发帖按钮, ubox :上传按钮,ti:标题区域 , con:内容区域 ,imgt :阅读查看区域 } }
  678. var _UDE = this.obj.cus;
  679. (_UDE.tr && (_UDE.tr.onclick = U.M.apply(this, this.fb), delete _UDE.tr));
  680. (_UDE.ubox) && (U.UP.AddFAN(_UDE.ubox, this.c.id, {
  681. width: "100%",
  682. height: "100%"
  683. }), U.UP.FAFZ({}, this.f, this.obj.type || "M"), delete _UDE.ubox);
  684. this.set(_UDE); //设置值使用
  685. },
  686. fb: function () { //发表文章
  687. var _UAS, _UTI, _UDTD = this.ti,
  688. _UCT = this.con.innerHTML,
  689. _UDAD = this.imgt ? $(this.imgt).Child() : null;
  690. if (_UDTD && (_UTI = _UDTD.value) && _UDTD.defaultValue == _UDTD.value) {
  691. _UAS = "请填写标题";
  692. _UDTD.focus();
  693. } //如果没有填写标题
  694. else if ((_UCT.isStrNull() || _UCT == "有什么和大家分享...") && ((_UCT = "图片分享") && (!_UDAD || !_UDAD.length))) {
  695. _UAS = "请填写内容";
  696. this.con.focus();
  697. } //内容判断
  698. else {
  699. if (this.obj.fcb && this.obj.fcb(_UCT, _UTI, _UDAD) !== true) {
  700. !this.parentEle && (this.obj.close !== false) && (U.D.CloseWindow(this.body, this.isc !== false ? "remove" : ""));
  701. } else {
  702. this.con.focus();
  703. }
  704. } //编辑框移除
  705. (_UAS) && (U.Alert(_UAS)); //成功
  706. },
  707. jd: function () { //焦点处理
  708. this.r.CreateR(); //重新记录焦点
  709. },
  710. uerror: function (UE) { //上传错误处理
  711. U.Alert("选择文件错误..");
  712. },
  713. Tool: function () { //工具隐藏处理
  714. var i, _UDTD,
  715. _UDAD = $(this.head).Child();
  716. for (i = 0; i < _UDAD.length; i++) {
  717. _UDTD = $(_UDAD[i]).Child()[0];
  718. if (_UDTD && _UDTD.tagName.toLowerCase() == "div") { $(_UDTD).css("display", "none"); }
  719. }
  720. },
  721. uadd: function (UDE, UL) { //文件上传添加
  722. var i, _UL;
  723. //图片最多上传数量处理
  724. if (this.obj.imgt) {
  725. if (this.obj.imgt - UDE.length < 0) {
  726. _UL = UDE.length - this.obj.imgt;
  727. for (i = 0; i < _UL; i++) {
  728. this.objfl.DF(UDE.length - i - 1, this.o.length);
  729. }
  730. UDE = UDE.slice(0, this.obj.imgt > UDE.length ? UDE.length : this.obj.imgt);
  731. } //超过数量
  732. this.obj.imgt -= UDE.length;
  733. }
  734. //设置文件上传的唯一识别id
  735. for (i = 0; i < UDE.length; i++) {
  736. UDE[i].id = Guid.newGuid();
  737. }
  738. //上传处理
  739. if (UL && UDE.length) {
  740. if (this.rt.add) { this.rt.add(UDE, UL) } //上传回调函数
  741. this.o.push(UDE); //添加到数组中
  742. (this.o.length == 1) && (this.up(UDE[0], 0, 0))
  743. }
  744. },
  745. up: function (UDE, UI, UJ) { //执行上传
  746. this.objfl.UpLoad(UJ, UI, (UDE || this.o[UI][UJ]).id); //执行上传
  747. },
  748. ujdt: function (UDE, UFID, UTF) { //进度条使用
  749. (this.rt.jdt) && (this.rt.jdt(UDE)); //返回进度条
  750. },
  751. ufup: (function () { //获取上传文件MD5 HASH值
  752. var asyn = function (r) {
  753. var context = r.context,
  754. _UDE = context[1],
  755. _UFID = context[2];
  756. r = r.value;
  757. if (r) {
  758. this.ufcp(r, _UFID);
  759. }
  760. else if ((!this.rt.fup) || (this.rt.fup(_UDE) !== false)) {
  761. 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]);
  762. }
  763. },
  764. _ = function (UWE, UFID) {
  765. var _UDE = this.getup(UFID);
  766. if (_UDE[0]) {
  767. U.A.Request(US.Auth, ["GetFileByHash", UWE, _UDE[0].size, _UDE[0].type.substr(1)], U.M.apply(this, asyn), (["", _UDE, UFID]));
  768. }
  769. else {
  770. this.ufcp(null, UFID)
  771. }
  772. }
  773. return _;
  774. })(),
  775. ucp: function (UDE) { //单个文件上传完毕
  776. },
  777. ufcp: function (UDE, UFID) { //获取返回值
  778. this.del(null, UFID); //上传成功后移除
  779. if (UDE && (!this.rt.fcp || this.rt.fcp(UDE, _UCE))) {
  780. (UDE.data) && ((UDE = U.M.toList(UDE.data)), UDE = {
  781. UserFilesServerName: UDE[0],
  782. UseFilesServerThumbnailName: UDE[1],
  783. UserFilesID: UDE[2],
  784. UserFilesSize: UDE[3],
  785. UserDirectoryEncrypt: UDE[4]
  786. });
  787. //服务器返回值处理
  788. if (UDE.data) {
  789. UDE = U.M.toList(UDE.data); //转化成json处理
  790. //服务器返回的
  791. UDE = {
  792. UserFilesServerName: UDE[0],
  793. UseFilesServerThumbnailName: UDE[1],
  794. UserFilesID: UDE[2],
  795. UserFilesSize: UDE[3],
  796. UserDirectoryEncrypt: UDE[4]
  797. }
  798. }
  799. //通过左下角追加崔丽
  800. if (this.imgt) {
  801. $$("img", {
  802. onerror: "U.M.ImgError(this, 2)",
  803. title: "右键删除",
  804. src: U.M.GetImgU(UDE.UserFilesServerName),
  805. alt: U.M.GetImgU(UDE.UserFilesServerName),
  806. onmouseup: U.M.apply(this, [
  807. [this.imgdel, ["this"]]
  808. ]),
  809. onclick: [
  810. [U.D.Img.Img, ([null, {
  811. UserFilesServerName: UDE.UserFilesServerName,
  812. UseFilesServerThumbnailName: UDE.UseFilesServerThumbnailName
  813. }])]
  814. ]
  815. }, this.imgt);
  816. }
  817. else { this.createFile(null, null, null, UDE); } //写入文件
  818. }
  819. (_UGE.length) && (this.up(null, 0, 0)); //成功上传后继续上传
  820. },
  821. createFile: function (URL, USN, UDOD, UDE) {
  822. var _UDOD, _UDTD, _UDSD, _UDMD, _UTH, _UGE = this.o;
  823. if (U.UP.IsImg(UDE.UserFilesServerName)) {
  824. _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>"
  825. }
  826. else { //普通文件处理
  827. _UDOD = $$("div", {
  828. contenteditable: "false",
  829. style: {
  830. "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"
  831. }
  832. });
  833. _UDTD = $$("div", {
  834. className: "UD_SYID",
  835. "style": {
  836. "cssText": "margin:10px 0 0 10px; width:40px; height:50px; margin:15px 0 0 10px; float:left; background-position:-261px -22px"
  837. }
  838. }, _UDOD);
  839. $$("div", {
  840. style: {
  841. cssText: "font-size:15px; width:40px; margin:auto; font-family:'微软雅黑'; text-align:center; color:#888; position:relative; top:16px; height:20px; overflow:hidden;"
  842. },
  843. innerHTML: U.UP.GetUpName(UDE.UserFilesServerName)[1]
  844. }, _UDTD);
  845. _UDTD = $$("div", {
  846. style: {
  847. "cssText": "width:195px; height:100%; margin-left:10px; float:left;"
  848. }
  849. }, _UDOD);
  850. _UDSD = $$("div", {
  851. style: {
  852. "cssText": "width:200px; height:35px; line-height:35px;"
  853. }
  854. }, _UDTD);
  855. _UDMD = $$("div", {
  856. innerHTML: "文档 容量大小 "
  857. }, _UDSD);
  858. $$("span", {
  859. innerHTML: U.UP.FileSize(UDE.UserFilesSize),
  860. style: {
  861. cssText: "color:#006699;"
  862. }
  863. }, _UDMD);
  864. _UDSD = $$("div", {
  865. style: {
  866. "cssText": "width:200px; height:35px; line-height:35px;"
  867. }
  868. }, _UDTD);
  869. _UDMD = $$("div", {
  870. style: {
  871. "cssText": "float:left; width:35px; height:35px;"
  872. }
  873. }, _UDSD);
  874. $$("img", {
  875. style: {
  876. "cssText": "width:30px; height:30px;"
  877. },
  878. src: U.M.GetImgU(US.userInfo.UserThumbnailImageHead)
  879. }, _UDMD);
  880. $$("div", {
  881. style: {
  882. "cssText": "float:left;padding:0 8px;max-width:50px;"
  883. },
  884. innerHTML: US.userInfo.UserName
  885. }, _UDSD);
  886. $$("a", {
  887. innerHTML: "点击下载",
  888. href: "/userpages/UD_XZ.htm?id=" + UDE.UserFilesID + "&type=file",
  889. target: "_blank"
  890. }, _UDSD);
  891. $("*", _UDOD).addAttrArray({
  892. contenteditable: "false"
  893. });
  894. _UTH = " &nbsp" + _UDOD.outerHTML + "&nbsp ";
  895. }
  896. this.r.add(_UTH);
  897. },
  898. AddUrl: function (URL) {
  899. URL = URL.value;
  900. this.r.add("<a href='" + URL + "' style='color:#3B639F;text-decoration:none;' target='_blank' >" + (URL) + "</a>");
  901. },
  902. imgdel: function (UDOD) { //图片删除
  903. if (event.button == 2) {
  904. this.obj.imgt++;
  905. $(UDOD).remove();
  906. }
  907. },
  908. uacp: function () { //所有文件上传完毕
  909. try {
  910. (!this.rt.acp) && (this.rt.acp());
  911. } catch (e) { }
  912. this.objfl.DAF();
  913. },
  914. del: function (UIE, UFID) { //删除上传后的实体
  915. var _UDE, UJ, _UGE = this.o;
  916. if (UIE != null) {
  917. _UGE.splice(UIE, 1);
  918. } else if (UFID) {
  919. _UDE = this.getup(UFID);
  920. (_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)));
  921. } //删除上传实体
  922. (!_UGE.length) && (this.uacp()); //所有的上传完毕
  923. },
  924. getup: function (UDID) { //获取上传文件实体
  925. var i, j, _UDE = this.o;
  926. for (i = 0; i < _UDE.length; i++) {
  927. for (j = 0; j < _UDE[i].length; j++) {
  928. if (_UDE[i][j].id == UDID) {
  929. return [_UDE[i][j], i, j];
  930. }
  931. }
  932. }
  933. return [null, -1, -1];
  934. },
  935. size: function () { //大小变化
  936. $(this.content).css("height", $(this.content).parentg().height() - 2 + "px");
  937. $(this.con).css("height", this.content.offsetHeight - (this.ti ? 115 : 70) - (this.head ? 33 : 0) - 1 + "px");
  938. },
  939. use: function (UDE, UTF) { //功能使用
  940. if (UTF) {
  941. var i, _UDOD = event.srcElement;
  942. for (i in UDE) {
  943. UDE[i] = UTF == "font" ? _UDOD.value + (i == "fontSize" ? "px" : "") : _UDOD.style[UTF];
  944. }
  945. }
  946. this.r.use(UDE);
  947. },
  948. cursor: (function () { //光标处理
  949. var _UDE, _ = function (UDOD, UDTD) {
  950. return new _UDE.init(UDOD, UDTD).bind();
  951. }
  952. _.prototype = _UDE = {
  953. init: function (UDOD, UDTD) { //初始化变量
  954. var _UDID = Guid.guidNoDash();
  955. U.Ut.AddObj(this, {
  956. iso: false,
  957. isb: false,
  958. el: UDOD,
  959. eb: UDTD,
  960. id: _UDID,
  961. sor: U.D.E.GetSelectionRange(window, UDTD, {
  962. "TF": _UDID
  963. })
  964. });
  965. },
  966. bind: function () { //事件绑定
  967. $(this.el).bind({
  968. mousedown: U.M.apply(this, this.create)
  969. });
  970. $(this.eb).bind({
  971. blur: U.M.apply(this, this.blur),
  972. focus: U.M.apply(this, this.focus)
  973. });
  974. return this; //失去焦点使用
  975. },
  976. blur: function () { //失去焦点使用
  977. if (!this.iso) {
  978. var _UDE = U.D.E.SORange.OAT[this.id],
  979. _UL = _UDE.length > 2 ? _UDE.length - 2 : _UDE.length - 1;
  980. this.sor = _UDE.length > 1 ? _UDE[_UDE.length - 2].OR : this.sor;
  981. }
  982. this.isb = true;
  983. },
  984. focus: function () { //聚焦使用
  985. this.isb = false;
  986. },
  987. create: function () { //重新添加光标位置
  988. var _UDOD = this.eb,
  989. _UDTD = event ? event.srcElement : null;
  990. this.iso = false;
  991. ((!_UDTD || (_UDOD !== _UDTD && !U.M.EISE(_UDOD, _UDTD)) && !this.isb)) && (this.sor.CreateR(), this.iso = true);
  992. },
  993. add: function (UST) { //写入内容
  994. this.eb.focus();
  995. this.sor.Replace(UST, null, true);
  996. this.sor.CreateR();
  997. },
  998. use: function (UDE) { //功能调用使用
  999. U.D.E.FontSizeType(this.sor.Parent(), UDE, this.sor, this.id);
  1000. }
  1001. }
  1002. _UDE.init.prototype = _UDE;
  1003. return _;
  1004. })(),
  1005. //插入表情包
  1006. face: function (UDOD, UIE) {
  1007. var _UIMG = "/img/ChatingFaceGif/[face](" + UIE + ").gif";
  1008. //$("#UF_FBD")[0].style.display = "none";
  1009. this.r.add(" " + $$("img", { "src": _UIMG, "contentEditable": "true" }).outerHTML + " "); //插入表情包
  1010. }
  1011. }
  1012. //#endregion
  1013. //表情包
  1014. /**
  1015. * 弹出表情框 对应表情框图片 /img/face.gif
  1016. *
  1017. */
  1018. U.UI.face = function (UDOD, UCB) {
  1019. var i, _UDTD,
  1020. _UDOD = $("#UF_FBD")[0];
  1021. if (_UDOD) {
  1022. $("#UF_FBD")[0].style.display = $("#UF_FBD")[0].style.display == "none" ? "block" : "none";
  1023. }
  1024. else {
  1025. _UDOD = $$("div", { "id": "UF_FBD", "class": "UF_FBD", "onmousedown": U.M.StopBubble }, UDOD);
  1026. _UDTD = $$("div", { "class": "UF_FNR" }, _UDOD);
  1027. for (i = 0; i <= 104; i++) {//循环表 情按钮
  1028. $$("div", { "className": "UF_FDG", "onclick": [UCB ? [UCB, [_UDOD, i]] : null] }, _UDTD);
  1029. }
  1030. }
  1031. }
  1032. //#region 对话框
  1033. /**
  1034. * 创建对话框
  1035. * @returns {function} 回调函数初始化
  1036. * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
  1037. */
  1038. U.UI.Confirm = function () {
  1039. return new U.UI.Confirm.init(arguments);
  1040. }
  1041. /**
  1042. * 初始化对话框实例
  1043. * @returns {function} 回调函数初始化
  1044. * @arguments 对象的 length 属性包含了传递给U.UI.Dialog的参数的数目。
  1045. */
  1046. U.UI.Confirm.init = function (UDE) {
  1047. var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "top"];
  1048. if (UDE.length < 4) {
  1049. var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
  1050. UDE = ["消息提示", { "width": "300px" }, UDE[2], UDE[1],
  1051. $$("div", {
  1052. "className": "U_UI_OC",
  1053. "style": {
  1054. "textAlign": "center",
  1055. "margin": "25px 0",
  1056. "max-width": "400px",
  1057. "word-wrap": "break-word",
  1058. "max-height": "400px",
  1059. "overflow": "auto"
  1060. },
  1061. innerHTML: UDE[0] ? UDE[0] : ""
  1062. })];
  1063. }
  1064. for (i = 0; i < UDE.length; i++) {
  1065. this[_UCE[i]] = UDE[i];
  1066. }
  1067. this.Create();
  1068. }
  1069. U.UI.Confirm.init.prototype = {
  1070. /**
  1071. * 创建对话框的ui
  1072. */
  1073. Create: function () {
  1074. var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
  1075. width: "auto",
  1076. height: "auto"
  1077. },
  1078. _UEK = (this.style = this.style || {});
  1079. _$(_USE).Each(function (UA, UB) {
  1080. _UEK[UB] = _UEK[UB] || UA;
  1081. });
  1082. _UEK.zIndex = 9999;
  1083. var _frag = $$("frag");
  1084. _UDOD = $$("div", { "className": "U_UI_OB" });
  1085. _UDTD = $$("div", { "className": "U_UI_OBA" }, _UDOD);
  1086. this.No = $$("div", {
  1087. "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]]))]],
  1088. "innerHTML": "取消",
  1089. "style": { "display": this.Q == true ? "none" : "block" },
  1090. "className": "U_UI_OBY"
  1091. }, _UDTD);
  1092. this.Yes = _UDSD = $$("div", {
  1093. "onclick": U.M.apply(this, [[this.confirmYesNo, [this.confirmYesClose]]]), //[(U.Ut.isArray(this.confirmYesClose) ? this.confirmYesClose : [this.confirmYesClose]), [_UCB]],
  1094. "innerHTML": "确定",
  1095. "className": "U_UI_OBY"
  1096. }, _UDTD); //确定按钮
  1097. _frag.appendChild(this.content);
  1098. _frag.appendChild(_UDOD);
  1099. this.form = _UDE = U.UI.Form({
  1100. id: "U_COF",
  1101. top: this.top ? true : false,
  1102. min: false,
  1103. max: false,
  1104. style: this.style,
  1105. title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
  1106. content: _frag,
  1107. hst: {
  1108. style: {
  1109. padding: "0"
  1110. }
  1111. },
  1112. draw: false
  1113. }); //创建对话框
  1114. // $(_UDE.body).append(_UDOD);
  1115. _UDID = $("input", _UDE.body);
  1116. for (i = _UDID.length - 1; i >= 0; i--) {
  1117. if ("text,password".indexOf(_UDID[i].type) > -1) {
  1118. _UDID[i].focus();
  1119. _UDID[i].onkeypress = U.M.apply(_UDID[i], [
  1120. [U.M.returnkeylogin, ([
  1121. [{
  1122. "obj": _UDSD,
  1123. "event": 'onclick'
  1124. }]
  1125. ])]
  1126. ]);
  1127. }
  1128. }
  1129. return _UDE;
  1130. },
  1131. /**
  1132. * 给对话框设置事件
  1133. * @param {object} 窗体事件使用
  1134. ----------[yes] {function} 确定的函数事件
  1135. ----------[no] {function} 取消的函数事件
  1136. */
  1137. AddEvent: function (UDE) {
  1138. for (var i in UDE) {
  1139. if (UDE.hasOwnProperty(i)) {
  1140. this[i].onclick = U.M.apply(this.form, [[this.form.shut], UDE[i]]); //
  1141. }
  1142. }
  1143. },
  1144. /**
  1145. * 给对话框设置事件
  1146. * @param {object} 窗体事件使用
  1147. */
  1148. confirmYesNo: function (UFN) {
  1149. var _UCB = U.M.apply(this.form, [[this.form.shut]]), //关闭窗体的函数
  1150. _UTF = U.Ut.isArray(UFN) ? U.M.apply(this, [UFN])() : (UFN) && (UFN.call(this));
  1151. if (_UTF !== false) { //不允许关闭
  1152. _UCB();
  1153. }
  1154. // [(U.Ut.isArray(this.confirmNoClose) ? this.confirmNoClose : [this.confirmNoClose]), [(_UCB = U.M.apply(_UDE, [[_UDE.shut]]))]]
  1155. }
  1156. }
  1157. /*U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
  1158. (!UDW || !UDH) && (UDW = "400px", UDH = "550px");
  1159. return U.UI.From({
  1160. id: UDID ? UDID : null,
  1161. style: { "width": parseInt(UDW) + "px", "height": parseInt(UDH) + "px" },
  1162. content: UDC ? UDC : null, title: UDT ? UDT : "通知",
  1163. min: false,
  1164. max: false,
  1165. draw: false
  1166. });
  1167. }*/
  1168. //U.UI.Confirm = function (UCT, UCBF, UCNF) {
  1169. // var _UDOD = $("#U_COF"); //创建一个ID为U_COF的对象
  1170. // if (_UDOD[0]) { //判断是否有U_COF的子节点,没有则创建
  1171. // _UDOD.childg(0, 1).childg(0, 0).html(UCT); //设置内容
  1172. // _UDOD.Center(); //内容居中
  1173. // } else {
  1174. // $(U.UI.Dialog("消息提示", {}, UCNF ? U.M.apply(this, [UCNF]) : null, UCBF ? U.M.apply(this, [UCBF]) : null,
  1175. // $$("div", {
  1176. // "className": "U_UI_OC",
  1177. // "style": {
  1178. // "textAlign": "center",
  1179. // "padding": "25px 0 25px 0"
  1180. // },
  1181. // innerHTML: UCT
  1182. // })).Create()).addAttrArray({
  1183. // "id": "U_COF"
  1184. // })[0];
  1185. // U.M.StopBubble(); //阻止冒泡
  1186. // return _UDOD;
  1187. //}
  1188. /**
  1189. * 创建一个通知形式的对话框
  1190. *{str} UDC 对话框里面的内容。
  1191. *{str} UDT 标题
  1192. *{str} UDID 对话框id
  1193. *{int} UDW 宽度
  1194. *{int} UDH 高度
  1195. * @returns 返回ID为U_COF的对象
  1196. **/
  1197. U.UI.Dialog = function (UDC, UDT, UDID, UDW, UDH) {
  1198. return new U.UI.Dialog.init(arguments);
  1199. }
  1200. U.M.Setprototype(U.UI.Dialog, U.Ut.AddObj(U.UI.Dialog, {
  1201. init: function (UDE) { //添加对话框信息
  1202. var i, _UCE = ["title", "style", "confirmNoClose", "confirmYesClose", "content", "SO"];
  1203. for (i = 0; i < UDE.length; i++) {
  1204. this[_UCE[i]] = UDE[i];
  1205. }
  1206. },
  1207. Create: function () { //创建对话框
  1208. var i, _UDE, _UDOD, _UDTD, _UDID, _UDSD, _UCB, _USE = {
  1209. width: "auto",
  1210. height: "auto",
  1211. minWidth: "300px"
  1212. },
  1213. _UEK = (this.style = this.style || {});
  1214. _$(_USE).Each(function (UA, UB) {
  1215. _UEK[UB] = _UEK[UB] || UA;
  1216. });
  1217. _UEK.zIndex = 9999;
  1218. _UDE = U.UI.Form({
  1219. top: true,
  1220. min: false,
  1221. max: false,
  1222. style: this.style,
  1223. title: "<div class='UD_SYF_STI'>" + (this.title || "对话框") + "</div>",
  1224. content: this.content,
  1225. hst: {
  1226. style: {
  1227. padding: "0"
  1228. }
  1229. }
  1230. }); //创建对话框
  1231. _UDOD = $$("div", {
  1232. "className": "U_UI_OB"
  1233. });
  1234. _UDTD = $$("div", {
  1235. "className": "U_UI_OBA"
  1236. }, _UDOD);
  1237. $$("div", {
  1238. "onclick": [
  1239. [this.confirmNoClose],
  1240. [(_UCB = U.M.apply(_UDE, [
  1241. [_UDE.close]
  1242. ]))]
  1243. ],
  1244. "innerHTML": "取消",
  1245. "className": "U_UI_OBY"
  1246. }, _UDTD);
  1247. _UDSD = $$("div", {
  1248. "onclick": [
  1249. [this.confirmYesClose],
  1250. [_UCB]
  1251. ],
  1252. "innerHTML": "确定",
  1253. "className": "U_UI_OBY"
  1254. }, _UDTD); //确定按钮
  1255. $(_UDE.body).append(_UDOD);
  1256. _UDID = $("input", _UDE.body);
  1257. for (i = _UDID.length - 1; i >= 0; i--) {
  1258. if ("text,password".indexOf(_UDID[i].type) > -1) {
  1259. _UDID[i].focus();
  1260. _UDID[i].onkeypress = U.M.apply(_UDID[i], [
  1261. [U.M.returnkeylogin, ([
  1262. [{
  1263. "obj": _UDSD,
  1264. "event": 'onclick'
  1265. }]
  1266. ])]
  1267. ]);
  1268. }
  1269. }
  1270. }
  1271. }));
  1272. U.UI.Dialog.init.prototype = U.UI.Dialog.prototype;
  1273. //#endregion
  1274. //#region RadioList
  1275. U.M.Setprototype(U.UI.RadioList, U.Ut.AddObj(U.UI.RadioList, {
  1276. init: function (UDOD, UDE, UCB) {
  1277. this.UDTD;
  1278. this.UDE = UDE;
  1279. this.UDOD = UDOD;
  1280. this.UCB = UCB;
  1281. this.create(UDOD);
  1282. }, //生成RadioList
  1283. create: function (UDOD) {
  1284. var i, _UDTD, _UDE = this.UDE,
  1285. _UN = Guid.guidNoDash(),
  1286. _UDFD = $$("frag");
  1287. if (_UDE) {
  1288. UDOD.innerText = "";
  1289. for (i in UDE) {
  1290. if (UDE.hasOwnProperty(i)) {
  1291. _UDTD = $$("div", {
  1292. "innerHTML": UDE[i],
  1293. "style": {
  1294. "cssText": "margin-left:5px;"
  1295. }
  1296. }, _UDFD);
  1297. _UDTD = $$("input", {
  1298. "type": "radio",
  1299. "value": i,
  1300. "name": _UN,
  1301. "checked": i ? false : true,
  1302. "onclick": U.M.apply(this, this.chang)
  1303. }, _UDTD);
  1304. (!i) && (this.UDTD = _UDTD);
  1305. }
  1306. }
  1307. UDOD.appendChild(_UDFD);
  1308. } else {
  1309. _UDTD = $("input[type='radio']", UDOD).addAttrArray({
  1310. "name": _UN,
  1311. "onclick": U.M.apply(this, this.chang)
  1312. });
  1313. for (i = 0; i < _UDTD.length; i++) {
  1314. if (_UDTD[i].checked) {
  1315. this.UDTD = _UDTD[i];
  1316. break;
  1317. }
  1318. }
  1319. } //设置相同的name
  1320. },
  1321. value: function () {
  1322. return this.UDTD.value;
  1323. }, //当前聚焦元素的值
  1324. element: function () {
  1325. return this.UDTD;
  1326. }, //当前聚焦元素
  1327. chang: function () {
  1328. var _UDOD = event.srcElement;
  1329. (_UDOD != this.UDTD) && (this.UDTD = _UDOD, (this.UCB) && (this.UCB(_UDOD)));
  1330. } //改变事件
  1331. }));
  1332. U.UI.RadioList.init.prototype = U.UI.RadioList.prototype;
  1333. //#endregion
  1334. //#region alert
  1335. /*
  1336. 弹出提示框,为了同时弹出多个提示框,为多份实例对象
  1337. 1、可以像java语言的用法,用new调用多份,例如: var a=new U.AlertB();
  1338. 2、也可以省略new的步骤,直接U.Alert(),出来的结果为多份。
  1339. 参数一:UTH 内容
  1340. 参数二:UTI 无确认按钮的显示时间
  1341. 参数三:是否带确认按钮
  1342. 返回值:
  1343. */
  1344. U.Alert = function (UTH, UTI, IFQ) {
  1345. IFQ === true ? new U.AlertA(UTH, IFQ) : new U.AlertB(UTH, UTI);
  1346. }
  1347. //为了多份实例,另外建立一个类似类的函数。
  1348. //带有确定按钮的alert
  1349. U.AlertA = function (UTH) {
  1350. U.UI.Confirm("提示框", {}, null, null, $$("div", {
  1351. "style": {
  1352. "textAlign": "center",
  1353. "margin": "25px 10px 25px 10px",
  1354. "max-width": "400px",
  1355. "word-wrap": "break-word",
  1356. "max-height": "400px",
  1357. "overflow": "auto"
  1358. },
  1359. innerHTML: UTH
  1360. }), true);
  1361. }
  1362. //自动消失的alert
  1363. U.AlertB = function (UTH, UTI) {
  1364. this.TI = ((UTI == null || UTI < 0) ? 1000 : UTI);
  1365. var _UDPD = $("body")[0];
  1366. this.UDOD = $($$("div", {
  1367. "innerHTML": UTH,
  1368. "className": "USalert",
  1369. "style": { "cssText": "z-index:9999;left:" + ((US.Width / 2 - 160) + _UDPD.scrollLeft) + "px;top:" + ((US.Height / 2 - 100) + _UDPD.scrollTop) + "px" },
  1370. "onclick": U.M.apply(this, [[this.DAlert, [true]]])
  1371. }, $("body")[0])).animate({
  1372. "top": US.Height / 2 - 80 + _UDPD.scrollTop + "px"
  1373. }, 300, U.M.apply(this, this.AsynAmAlert));
  1374. }
  1375. //为了减少内存消耗,把方法写在原型中。
  1376. U.AlertB.prototype = {
  1377. // init: function (UTH, UTI) {//创建alert "id": "USalert",
  1378. // 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));
  1379. // },
  1380. AsynAmAlert: function () { //等待动画
  1381. this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
  1382. },
  1383. AmAlert: function () { //结束动画
  1384. (this.UTI) && (clearTimeout(this.UTI));
  1385. var _UDOD = $(this.UDOD);
  1386. (_UDOD.Parent() == document.body) && (_UDOD.animate({
  1387. "top": _UDOD[0].offsetTop - 70 + "px"
  1388. }, 100, U.M.apply(this, this.DAlert)));
  1389. },
  1390. DAlert: function (UTF) { //移除alert
  1391. if (this.TI || UTF) {
  1392. $(this.UDOD).remove();
  1393. }
  1394. }
  1395. }
  1396. //U.M.Setprototype(U.AlertB, {
  1397. // // init: function (UTH, UTI) {//创建alert "id": "USalert",
  1398. // // 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));
  1399. // // },
  1400. // AsynAmAlert: function () {//等待动画
  1401. // this.UTI = setTimeout(U.M.apply(this, this.AmAlert), this.TI || 1000); //异步等待
  1402. // },
  1403. // AmAlert: function () {//结束动画
  1404. // (this.UTI) && (clearTimeout(this.UTI)); var _UDOD = $(this.UDOD);
  1405. // (_UDOD.Parent() == document.body) && (_UDOD.animate({ "top": US.Height / 2 - 70 + "px" }, 100, U.M.apply(this, this.DAlert)));
  1406. // },
  1407. // DAlert: function (UTF) { //移除alert
  1408. // if (this.TI || UTF) { $(this.UDOD).remove(); }
  1409. // }
  1410. //}); //U.Ut.AddObj(U.Alert,})
  1411. //U.Alert.prototype.init.prototype = U.Alert.prototype;
  1412. //#endregion