import.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /**
  2. * 开发版本的文件导入
  3. */
  4. (function() {
  5. /* 可能的文件路径,已按照依赖关系排序 */
  6. var pathInfo = [
  7. /* 依赖库 */
  8. { path: 'lib/jquery-2.1.1.js', pack: '*' },
  9. { path: 'lib/promise-1.0.0.js', pack: '*' },
  10. { path: 'lib/jquery.xml2json.js', pack: 'edit|share|m-share' },
  11. { path: 'lib/jquery.transit.min.js', pack: 'edit|share|m-share' },
  12. { path: 'lib/jquery.blob.js', pack: 'edit' },
  13. { path: 'lib/zip.js', pack: 'edit' },
  14. { path: 'lib/ZeroClipboard.min.js', pack: 'edit' },
  15. { path: 'lib/qrcode.js', pack: 'edit' },
  16. { path: 'lib/fui/dev-lib/jhtmls.min.js', pack: 'edit|share|m-share' },
  17. { path: 'lib/fui/dist/fui.all.js', pack: 'edit|share|m-share' },
  18. { path: 'lib/fio/src/fio.js', pack: 'index|edit' },
  19. { path: 'lib/fio/provider/netdisk/oauth.js', pack: 'index|edit' },
  20. { path: 'lib/fio/provider/netdisk/netdisk.js', pack: 'edit' },
  21. { path: 'lib/marked/lib/marked.js', pack: 'edit|share' },
  22. { path: 'lib/bower/codemirror/lib/codemirror.js', pack: 'edit' },
  23. { path: 'lib/bower/codemirror/mode/xml/xml.js', pack: 'edit' },
  24. { path: 'lib/bower/codemirror/mode/javascript/javascript.js', pack: 'edit' },
  25. { path: 'lib/bower/codemirror/mode/css/css.js', pack: 'edit' },
  26. { path: 'lib/bower/codemirror/mode/htmlmixed/htmlmixed.js', pack: 'edit' },
  27. { path: 'lib/bower/codemirror/mode/markdown/markdown.js', pack: 'edit' },
  28. { path: 'lib/bower/codemirror/addon/mode/overlay.js', pack: 'edit' },
  29. { path: 'lib/bower/codemirror/mode/gfm/gfm.js', pack: 'edit' },
  30. /* Kity 依赖库 */
  31. { path: 'lib/kity/dist/kity.js', pack: 'edit|share|m-share' },
  32. /* 核心代码 */
  33. { path: 'src/core/kityminder.js', pack: 'edit|share|m-share' },
  34. { path: 'src/core/utils.js', pack: 'edit|share|m-share' },
  35. { path: 'src/core/browser.js', pack: 'edit|share|m-share' },
  36. { path: 'src/core/minder.js', pack: 'edit|share|m-share' },
  37. { path: 'src/core/command.js', pack: 'edit|share|m-share' },
  38. { path: 'src/core/node.js', pack: 'edit|share|m-share' },
  39. { path: 'src/core/option.js', pack: 'edit|share|m-share' },
  40. { path: 'src/core/event.js', pack: 'edit|share|m-share' },
  41. { path: 'src/core/status.js', pack: 'edit|share|m-share' },
  42. { path: 'src/core/paper.js', pack: 'edit|share|m-share' },
  43. { path: 'src/core/select.js', pack: 'edit|share|m-share' },
  44. { path: 'src/core/key.js', pack: 'edit|share|m-share' },
  45. { path: 'src/core/contextmenu.js', pack: 'edit|share|m-share' },
  46. { path: 'src/core/module.js', pack: 'edit|share|m-share' },
  47. { path: 'src/core/data.js', pack: 'edit|share|m-share' },
  48. { path: 'src/core/readonly.js', pack: 'edit|share|m-share' },
  49. { path: 'src/core/layout.js', pack: 'edit|share|m-share' },
  50. { path: 'src/core/theme.js', pack: 'edit|share|m-share' },
  51. { path: 'src/core/compatibility.js', pack: 'edit|share|m-share' },
  52. { path: 'src/core/render.js', pack: 'edit|share|m-share' },
  53. { path: 'src/core/connect.js', pack: 'edit|share|m-share' },
  54. { path: 'src/core/template.js', pack: 'edit|share|m-share' },
  55. { path: 'src/core/lang.js', pack: 'edit|share|m-share' },
  56. { path: 'src/core/defaultoptions.js', pack: 'edit|share|m-share' },
  57. { path: 'src/core/preference.js', pack: 'edit|share|m-share' },
  58. { path: 'src/core/keymap.js', pack: 'edit|share|m-share' },
  59. /* 布局 */
  60. { path: 'src/layout/mind.js', pack: 'edit|share|m-share' },
  61. { path: 'src/layout/filetree.js', pack: 'edit|share|m-share' },
  62. { path: 'src/layout/btree.js', pack: 'edit|share|m-share' },
  63. { path: 'src/layout/fish-bone-master.js', pack: 'edit|share|m-share' },
  64. { path: 'src/layout/fish-bone-slave.js', pack: 'edit|share|m-share' },
  65. { path: 'src/layout/tianpan.js', pack: 'edit|share|m-share' },
  66. /* 连线 */
  67. { path: 'src/connect/bezier.js', pack: 'edit|share|m-share' },
  68. { path: 'src/connect/poly.js', pack: 'edit|share|m-share' },
  69. { path: 'src/connect/arc.js', pack: 'edit|share|m-share' },
  70. { path: 'src/connect/under.js', pack: 'edit|share|m-share' },
  71. { path: 'src/connect/l.js', pack: 'edit|share|m-share' },
  72. { path: 'src/connect/fish-bone-master.js', pack: 'edit|share|m-share' },
  73. { path: 'src/connect/arc_tp.js', pack: 'edit|share|m-share' },
  74. /* 皮肤 */
  75. { path: 'src/theme/default.js', pack: 'edit|share|m-share' },
  76. { path: 'src/theme/snow.js', pack: 'edit|share|m-share' },
  77. { path: 'src/theme/fresh.js', pack: 'edit|share|m-share' },
  78. { path: 'src/theme/fish.js', pack: 'edit|share|m-share' },
  79. { path: 'src/theme/wire.js', pack: 'edit|share|m-share' },
  80. { path: 'src/theme/tianpan.js', pack: 'edit|share|m-share' },
  81. /* 模板 */
  82. { path: 'src/template/default.js', pack: 'edit|share|m-share' },
  83. { path: 'src/template/structure.js', pack: 'edit|share|m-share' },
  84. { path: 'src/template/filetree.js', pack: 'edit|share|m-share' },
  85. { path: 'src/template/right.js', pack: 'edit|share|m-share' },
  86. { path: 'src/template/fish-bone.js', pack: 'edit|share|m-share' },
  87. { path: 'src/template/tianpan.js', pack: 'edit|share|m-share' },
  88. /* 模块 */
  89. { path: 'src/module/node.js', pack: 'edit|share|m-share' },
  90. { path: 'src/module/text.js', pack: 'edit|share|m-share' },
  91. { path: 'src/module/expand.js', pack: 'edit|share|m-share' },
  92. { path: 'src/module/outline.js', pack: 'edit|share|m-share' },
  93. { path: 'src/module/geometry.js', pack: 'edit|share|m-share' },
  94. { path: 'src/module/history.js', pack: 'edit|share|m-share' },
  95. { path: 'src/module/progress.js', pack: 'edit|share|m-share' },
  96. { path: 'src/module/priority.js', pack: 'edit|share|m-share' },
  97. { path: 'src/module/image.js', pack: 'edit|share|m-share' },
  98. { path: 'src/module/resource.js', pack: 'edit|share|m-share' },
  99. { path: 'src/module/note.js', pack: 'edit|share|m-share' },
  100. { path: 'src/module/view.js', pack: 'edit|share|m-share' },
  101. { path: 'src/module/dragtree.js', pack: 'edit|share|m-share' },
  102. { path: 'src/module/keynav.js', pack: 'edit|share|m-share' },
  103. { path: 'src/module/select.js', pack: 'edit|share|m-share' },
  104. { path: 'src/module/history.js', pack: 'edit' },
  105. { path: 'src/module/editor.js', pack: 'edit' },
  106. { path: 'src/module/editor.keyboard.js', pack: 'edit' },
  107. { path: 'src/module/editor.range.js', pack: 'edit' },
  108. { path: 'src/module/editor.receiver.js', pack: 'edit' },
  109. { path: 'src/module/editor.selection.js', pack: 'edit' },
  110. { path: 'src/module/basestyle.js', pack: 'edit|share|m-share' },
  111. { path: 'src/module/font.js', pack: 'edit|share|m-share' },
  112. { path: 'src/module/zoom.js', pack: 'edit|share|m-share' },
  113. { path: 'src/module/hyperlink.js', pack: 'edit|share|m-share' },
  114. { path: 'src/module/arrange.js', pack: 'edit' },
  115. { path: 'src/module/clipboard.js', pack: 'edit' },
  116. { path: 'src/module/style.js', pack: 'edit' },
  117. /* 格式支持 */
  118. { path: 'src/protocol/xmind.js', pack: 'edit' },
  119. { path: 'src/protocol/freemind.js', pack: 'edit' },
  120. { path: 'src/protocol/mindmanager.js', pack: 'edit' },
  121. { path: 'src/protocol/plain.js', pack: 'edit|share|m-share' },
  122. { path: 'src/protocol/markdown.js', pack: 'edit|share|m-share' },
  123. { path: 'src/protocol/json.js', pack: 'edit|share|m-share' },
  124. { path: 'src/protocol/png.js', pack: 'edit|share|m-share' },
  125. { path: 'src/protocol/svg.js', pack: 'edit|share|m-share' },
  126. /* UI 基础 */
  127. { path: 'ui/ui.js', pack: 'edit|share|m-share' },
  128. { path: 'ui/eve.js', pack: 'edit|share|m-share' },
  129. { path: 'ui/memory.js', pack: 'edit|share|m-share' },
  130. { path: 'ui/fuix.js', pack: 'edit|share|m-share' },
  131. { path: 'ui/axss.js', pack: 'edit|share|m-share' },
  132. { path: 'ui/fiox.js', pack: 'edit' },
  133. /* UI 组件 */
  134. { path: 'ui/widget/commandbutton.js', pack: 'edit|share' },
  135. { path: 'ui/widget/commandbuttonset.js', pack: 'edit' },
  136. { path: 'ui/widget/commandinputmenu.js', pack: 'edit' },
  137. { path: 'ui/widget/commandselectmenu.js', pack: 'edit' },
  138. { path: 'ui/widget/notice.js', pack: 'edit|share|m-share' },
  139. { path: 'ui/widget/friendlytimespan.js', pack: 'edit' },
  140. { path: 'ui/widget/locallist.js', pack: 'edit' },
  141. { path: 'ui/widget/netdiskfinder.js', pack: 'edit' },
  142. { path: 'ui/widget/menutab.js', pack: 'edit|share|m-share' },
  143. /* 基本业务 */
  144. { path: 'ui/doc.js', pack: 'edit|share|m-share' },
  145. { path: 'ui/contextmenu.js', pack: 'edit|share' },
  146. /* 视野导航 */
  147. { path: 'ui/nav.js', pack: 'edit|share' },
  148. /* UI Top Bar */
  149. { path: 'ui/topbar/moreservice.js', pack: 'edit|share'},
  150. /* UI 菜单 */
  151. { path: 'ui/menu/menu.js', pack: 'edit|share' },
  152. { path: 'ui/menu/header.js', pack: 'edit|share' },
  153. { path: 'ui/menu/default.js', pack: 'edit' },
  154. /* UI 菜单 - 新建 */
  155. { path: 'ui/menu/new/new.js', pack: 'edit' },
  156. /* UI 菜单 - 打开 */
  157. { path: 'ui/menu/open/open.js', pack: 'edit' },
  158. { path: 'ui/menu/open/recent.js', pack: 'edit' },
  159. { path: 'ui/menu/open/netdisk.js', pack: 'edit' },
  160. { path: 'ui/menu/open/local.js', pack: 'edit' },
  161. { path: 'ui/menu/open/draft.js', pack: 'edit' },
  162. /* UI 菜单 - 保存 */
  163. { path: 'ui/menu/save/save.js', pack: 'edit|share' },
  164. { path: 'ui/menu/save/netdisk.js', pack: 'edit' },
  165. { path: 'ui/menu/save/download.js', pack: 'edit|share' },
  166. /* UI 菜单 - 分享 */
  167. { path: 'ui/menu/share/share.js', pack: 'edit' },
  168. { path: 'ui/menu/share/view.js', pack: 'share' },
  169. { path: 'ui/menu/share/m-share.js', pack: 'm-share' },
  170. /* UI 菜单 - 帮助 */
  171. { path: 'ui/menu/help/help.js', pack: 'edit|share'},
  172. { path: 'ui/menu/help/feedback.js', pack: 'edit|share'},
  173. /* UI Top Bar */
  174. { path: 'ui/topbar/quickvisit.js', pack: 'edit|share' },
  175. { path: 'ui/topbar/history.js', pack: 'edit' },
  176. { path: 'ui/topbar/user.js', pack: 'edit' },
  177. { path: 'ui/topbar/feedback.js', pack: 'edit|share' },
  178. { path: 'ui/topbar/search.js', pack: 'edit|share' },
  179. { path: 'ui/topbar/switch-view.js', pack: 'm-share' },
  180. { path: 'ui/topbar/m-logo.js', pack: 'm-share' },
  181. { path: 'ui/topbar/title.js', pack: 'edit|share|m-share' },
  182. /* UI Ribbon */
  183. { path: 'ui/ribbon/tabs.js', pack: 'edit' },
  184. /* UI Ribbon「思路」面板 */
  185. { path: 'ui/ribbon/idea/insert.js', pack: 'edit' },
  186. { path: 'ui/ribbon/idea/arrange.js', pack: 'edit' },
  187. { path: 'ui/ribbon/idea/operation.js', pack: 'edit' },
  188. { path: 'ui/ribbon/idea/attachment.js', pack: 'edit' },
  189. { path: 'ui/ribbon/idea/link.js', pack: 'edit' },
  190. { path: 'ui/ribbon/idea/image.js', pack: 'edit' },
  191. { path: 'ui/ribbon/idea/note.js', pack: 'edit' },
  192. { path: 'ui/ribbon/idea/notepreview.js', pack: 'edit|share' },
  193. { path: 'ui/ribbon/idea/priority.js', pack: 'edit' },
  194. { path: 'ui/ribbon/idea/progress.js', pack: 'edit' },
  195. { path: 'ui/ribbon/idea/resource.js', pack: 'edit' },
  196. /* UI Ribbon「展示」面板 */
  197. { path: 'ui/ribbon/appearence/template.js', pack: 'edit' },
  198. { path: 'ui/ribbon/appearence/theme.js', pack: 'edit' },
  199. { path: 'ui/ribbon/appearence/layout.js', pack: 'edit' },
  200. { path: 'ui/ribbon/appearence/style.js', pack: 'edit' },
  201. { path: 'ui/ribbon/appearence/font.js', pack: 'edit' },
  202. { path: 'ui/ribbon/appearence/color.js', pack: 'edit' },
  203. /* UI Ribbon「视图」面板 */
  204. { path: 'ui/ribbon/view/fullscreen.js', pack: 'edit' },
  205. { path: 'ui/ribbon/view/level.js', pack: 'edit' },
  206. { path: 'ui/ribbon/view/select.js', pack: 'edit' }
  207. ];
  208. if (typeof(module) === 'object' && module.exports) {
  209. module.exports = pathInfo;
  210. }
  211. else if (document) {
  212. // currentScript polyfill
  213. if("undefined" === typeof document.currentScript){
  214. (function(){
  215. /***************************************************************************/
  216. /* document.currentScript polyfill + improvements */
  217. /***************************************************************************/
  218. var scripts = document.getElementsByTagName('script');
  219. document._currentScript = document.currentScript;
  220. // return script object based off of src
  221. var getScriptFromURL = function(url) {
  222. for (var i = 0; i < scripts.length; i++)
  223. if (scripts[i].src === url)
  224. return scripts[i];
  225. return undefined;
  226. };
  227. var actualScript = document.actualScript = function() {
  228. if (document._currentScript)
  229. return document._currentScript;
  230. var stack;
  231. try {
  232. window.omgwtf();
  233. } catch(e) {
  234. stack = e.stack;
  235. }
  236. if (!stack)
  237. return undefined;
  238. var e = stack.indexOf(' at ') !== -1 ? ' at ' : '@';
  239. while (stack.indexOf(e) !== -1)
  240. stack = stack.substring(stack.indexOf(e) + e.length);
  241. stack = stack.substring(stack.indexOf('http'), stack.indexOf(':', stack.indexOf(':')+1));
  242. return getScriptFromURL(stack);
  243. };
  244. if (document.__defineGetter__)
  245. document.__defineGetter__('currentScript', actualScript);
  246. })();
  247. }
  248. /* jshint browser:true */
  249. var script = document.currentScript || document.actualScript();
  250. var src = script.src;
  251. var pack = /pack=([\w-]+)(?:&|$)/.exec(src);
  252. if (!pack) return;
  253. pack = pack[1];
  254. while (pathInfo.length) {
  255. var info = pathInfo.shift();
  256. if (info.pack == '*' || info.pack.split('|').indexOf(pack) != -1) {
  257. window.document.write('<script type="text/javascript" src="' + info.path + '"></script>');
  258. }
  259. }
  260. }
  261. })();