Advertisement
Guest User

Untitled

a guest
Apr 9th, 2015
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. define("normalize", [], function() {
  2. function s(e, i, s) {
  3. if (e.match(r) || e.match(n)) return e;
  4. e = t(e);
  5. var a = s.match(n),
  6. f = i.match(n);
  7. return f && (!a || a[1] != f[1] || a[2] != f[2]) ? o(e, i) : u(o(e, i), s)
  8. }
  9.  
  10. function o(e, t) {
  11. e.substr(0, 2) == "./" && (e = e.substr(2));
  12. if (e.match(r) || e.match(n)) return e;
  13. var i = t.split("/"),
  14. s = e.split("/");
  15. i.pop();
  16. while (curPart = s.shift()) curPart == ".." ? i.pop() : i.push(curPart);
  17. return i.join("/")
  18. }
  19.  
  20. function u(e, t) {
  21. var n = t.split("/");
  22. n.pop(), t = n.join("/") + "/", i = 0;
  23. while (t.substr(i, 1) == e.substr(i, 1)) i++;
  24. while (t.substr(i, 1) != "/") i--;
  25. t = t.substr(i + 1), e = e.substr(i + 1), n = t.split("/");
  26. var r = e.split("/");
  27. out = "";
  28. while (n.shift()) out += "../";
  29. while (curPart = r.shift()) out += curPart + "/";
  30. return out.substr(0, out.length - 1)
  31. }
  32. var e = /([^:])\/+/g,
  33. t = function(t) {
  34. return t.replace(e, "$1/")
  35. },
  36. n = /[^\:\/]*:\/\/([^\/])*/,
  37. r = /^(\/|data:)/,
  38. a = function(e, n, r) {
  39. n = t(n), r = t(r);
  40. var i = /@import\s*("([^"]*)"|'([^']*)')|url\s*\((?!#)\s*(\s*"([^"]*)"|'([^']*)'|[^\)]*\s*)\s*\)/ig,
  41. o, u, e;
  42. while (o = i.exec(e)) {
  43. u = o[3] || o[2] || o[5] || o[6] || o[4];
  44. var a;
  45. a = s(u, n, r);
  46. var f = o[5] || o[6] ? 1 : 0;
  47. e = e.substr(0, i.lastIndex - u.length - f - 1) + a + e.substr(i.lastIndex - f - 1), i.lastIndex = i.lastIndex + (a.length - u.length)
  48. }
  49. return e
  50. };
  51. return a.convertURIBase = s, a.absoluteURI = o, a.relativeURI = u, a
  52. }), define("RequireCss", [], function() {
  53. if ("undefined" == typeof window) return {
  54. load: function(e, t, n) {
  55. n()
  56. }
  57. };
  58. var e = document.getElementsByTagName("head")[0],
  59. t = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/) || 0,
  60. n = !1,
  61. r = !0;
  62. t[1] || t[7] ? n = parseInt(t[1]) < 6 || parseInt(t[7]) <= 9 : t[2] ? r = !1 : t[4] && (n = parseInt(t[4]) < 18);
  63. var i = {};
  64. i.pluginBuilder = "./css-builder";
  65. var s, o, u, a = function() {
  66. s = document.createElement("style"), e.appendChild(s), o = s.styleSheet || s.sheet
  67. },
  68. f = 0,
  69. l = [],
  70. c = function(e) {
  71. f++, 32 == f && (a(), f = 0), o.addImport(e), s.onload = h
  72. },
  73. h = function() {
  74. u();
  75. var e = l.shift();
  76. return e ? (u = e[1], void c(e[0])) : void(u = null)
  77. },
  78. p = function(e, t) {
  79. if (o && o.addImport || a(), o && o.addImport) u ? l.push([e, t]) : (c(e), u = t);
  80. else {
  81. s.textContent = '@import "' + e + '";';
  82. var n = setInterval(function() {
  83. try {
  84. s.sheet.cssRules, clearInterval(n), t()
  85. } catch (e) {}
  86. }, 10)
  87. }
  88. },
  89. d = function(t, n) {
  90. var i = document.createElement("link");
  91. if (i.type = "text/css", i.rel = "stylesheet", r) i.onload = function() {
  92. i.onload = function() {}, setTimeout(n, 7)
  93. };
  94. else var s = setInterval(function() {
  95. for (var e = 0; e < document.styleSheets.length; e++) {
  96. var t = document.styleSheets[e];
  97. if (t.href == i.href) return clearInterval(s), n()
  98. }
  99. }, 10);
  100. i.href = t, e.appendChild(i)
  101. };
  102. return i.normalize = function(e, t) {
  103. return ".css" == e.substr(e.length - 4, 4) && (e = e.substr(0, e.length - 4)), t(e)
  104. }, i.load = function(e, t, r) {
  105. (n ? p : d)(t.toUrl(e + ".css"), r)
  106. }, i
  107. }), define("RequireCss!styles", [], function() {}), require.config({
  108. map: {
  109. "*": {
  110. css: "require-css/css.min.js"
  111. }
  112. }
  113. }), define("Test", ["css!styles.css"], function() {
  114. return function() {}
  115. }), require(["Test"], function(e) {}), define("script", function() {}),
  116. function(e) {
  117. var t = document,
  118. n = "appendChild",
  119. r = "styleSheet",
  120. i = t.createElement("style");
  121. i.type = "text/css", t.getElementsByTagName("head")[0][n](i), i[r] ? i[r].cssText = e : i[n](t.createTextNode(e))
  122. }("body{color:red}\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement