Advertisement
Guest User

Untitled

a guest
Jun 9th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.29 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  5. <!-- Le styles -->
  6. <link href="http://localhost/design/css/bootstrap.css" rel="stylesheet">
  7. <link href="http://localhost/design/css/bootstrap-responsive.css" rel="stylesheet">
  8. <script>
  9. function setCookie(c_name,value,exdays)
  10. {
  11. var exdate=new Date();
  12. exdate.setDate(exdate.getDate() + exdays);
  13. var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
  14. document.cookie=c_name + "=" + c_value;
  15. }
  16. function getCookie(c_name)
  17. {
  18. var c_value = document.cookie;
  19. var c_start = c_value.indexOf(" " + c_name + "=");
  20. if (c_start == -1)
  21. {
  22. c_start = c_value.indexOf(c_name + "=");
  23. }
  24. if (c_start == -1)
  25. {
  26. c_value = null;
  27. }
  28. else
  29. {
  30. c_start = c_value.indexOf("=", c_start) + 1;
  31. var c_end = c_value.indexOf(";", c_start);
  32. if (c_end == -1)
  33. {
  34. c_end = c_value.length;
  35. }
  36. c_value = unescape(c_value.substring(c_start,c_end));
  37. }
  38. return c_value;
  39. }
  40. function addnewdiv() {
  41. var fc = $("#fcolor").val();
  42. var width = $("#width").val();
  43. var height = $("#height").val();
  44. var bg = $("#bgcolor").val();
  45. var divname = $("#divname").val();
  46. var divstyle = 'color:'+fc+'; width:'+width+'; height:'+height+'; background-color:'+bg+';';
  47. var mynewdiv = '<div id="'+divname+'" class="'+divname+'" style="'+divstyle+'"><p id="content-'+divname+'"></p></div>';
  48. if(divname=='') {
  49. $("#errors-modal").html('<font color="red">Error: Div name required</font><br>');
  50. } else {
  51. $("#core-wrapper").append(mynewdiv);
  52. $("#"+divname).draggable();
  53. addeditmount(divname);
  54. $("#modal-newdiv").modal('hide');
  55. $("#divname").val('');
  56. }
  57. }
  58. function addeditmount(p_id) {
  59. var pfun = "'"+p_id+"'";
  60. $("#"+p_id).prepend('<button id="edit_content" onclick="addcookiesbro('+pfun+')" type="button" data-toggle="modal" data-target="#modal-editcontent">Edit content</button>');
  61. var text_content_one = $("#content-"+p_id).text();
  62. $("#edit_content").click(function() { $("#content-new").val(text_content_one); });
  63. }
  64. $(document).ready(function(){$('#modal-editcontent').on('shown', function() { getcontentbro(); });});
  65. function getcontentbro() {
  66. var gc = getCookie("editing_id");
  67. $("#content-new").val($("#content-"+gc).html());
  68. }
  69. function addcookiesbro(p_id) {
  70. setCookie("editing_id",p_id);
  71. }
  72. function updatecontent(p_id) {
  73. var newtext = $("#content-new").val();
  74. $("#content-"+p_id).html(newtext);
  75. $("#para").html('');
  76. $("#content-new").val('');
  77. $("#modal-editcontent").modal('hide');
  78. }
  79. function loadcssforme() {
  80. $("#css").html($("#custom_css").html().trim());
  81. }
  82. function updatecss() {
  83. $("#custom_css").html($("#css").val());
  84. $("#modal-editcss").modal('hide');
  85. }
  86. function redesignsite() {
  87. $("div").each(function() { $(this).draggable(); });
  88. $("a").each(function() { $(this).draggable(); });
  89. $("ul").each(function() { $(this).draggable(); });
  90. $("li").each(function() { $(this).draggable(); });
  91. $("img").each(function() { $(this).draggable(); });
  92. $("button").each(function() { $(this).draggable(); });
  93. $("input").each(function() { $(this).draggable(); });
  94. $("p").each(function() { $(this).draggable(); });
  95. $("b").each(function() { $(this).draggable(); });
  96. $("tr").each(function() { $(this).draggable(); });
  97. $("td").each(function() { $(this).draggable(); });
  98. }
  99. function loadexisting() {
  100. $("#core-wrapper").html($("#existing-content").val());
  101. $("#modal-exitexisting").modal('hide');
  102. redesignsite();
  103. }
  104. </script>
  105. </head>
  106. <body>
  107. <style id="custom_css">
  108.  
  109. </style>
  110. <div id="design-unit">
  111. <button type="button" data-toggle="modal" class="btn" data-target="#modal-exitexisting">Redesign existing site</button> <button onclick="redesignsite()" type="button" class="btn">Load dragging [existing site]</button> <button class="btn" type="button" data-toggle="modal" data-target="#modal-newdiv">Create new div</button> <button class="btn" onclick="loadcssforme()" type="button" data-toggle="modal" data-target="#modal-editcss">Edit CSS</button>
  112. </div>
  113. <div id="modal-newdiv" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  114. <div class="modal-header">
  115. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  116. <h3 id="myModalLabel">Create new div</h3>
  117. </div>
  118. <div class="modal-body">
  119. <p> <div id="errors-modal"></div>
  120. Div Name: <input id="divname" type="text" name="divname" value="" required><br>
  121. Font colour: <input id="fcolor" type="text" name="fcolor" value="#FFFFFF"><br>
  122. Width: <input id="width" type="text" name="width" value="100px"><br>
  123. Height: <input id="height" type="text" name="height" value="100px"><br>
  124. BG Color: <input id="bgcolor" type="text" name="" value="#000000"><br>
  125. </p>
  126. </div>
  127. <div class="modal-footer">
  128. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  129. <button onclick="addnewdiv()" class="btn btn-primary">Create</button>
  130. </div>
  131. </div>
  132. <div id="modal-editcontent" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  133. <div class="modal-header">
  134. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  135. <h3 id="myModalLabel">Edit Paragraph Content</h3>
  136. </div>
  137. <div class="modal-body" id="raw_html_supported">
  138. <p> <div id="errors-modal"></div><br><div style="display:none;" id="para"></div>
  139. <b>RAW HTML Supported</b>
  140. <textarea id="content-new" name="content-new">
  141.  
  142. </textarea>
  143. </p>
  144. </div>
  145. <div class="modal-footer">
  146. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  147. <button onclick="updatecontent(getCookie('editing_id'))" class="btn btn-primary">Create</button>
  148. </div>
  149. </div>
  150. <div id="modal-editcss" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  151. <div class="modal-header">
  152. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  153. <h3 id="myModalLabel">Edit Paragraph Content</h3>
  154. </div>
  155. <div class="modal-body" id="raw_html_supported">
  156. <p> <div id="errors-modal"></div><br><script>getcontentbro();</script>
  157. <textarea id="css" style="margin: 0px 0px 10px; height: 174px; width: 517px;" name="css"></textarea>
  158. </p>
  159. </div>
  160. <div class="modal-footer">
  161. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  162. <button onclick="updatecss()" class="btn btn-primary">Create</button>
  163. </div>
  164. </div>
  165. <div id="modal-editcontent" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  166. <div class="modal-header">
  167. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  168. <h3 id="myModalLabel">Edit Paragraph Content</h3>
  169. </div>
  170. <div class="modal-body" id="raw_html_supported">
  171. <p> <div id="errors-modal"></div><br><div style="display:none;" id="para"></div>
  172. <b>RAW HTML Supported</b>
  173. <textarea id="content-new" name="content-new">
  174.  
  175. </textarea>
  176. </p>
  177. </div>
  178. <div class="modal-footer">
  179. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  180. <button onclick="updatecontent(getCookie('editing_id'))" class="btn btn-primary">Create</button>
  181. </div>
  182. </div>
  183. <div id="modal-exitexisting" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  184. <div class="modal-header">
  185. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  186. <h3 id="myModalLabel">Edit Existing Website</h3>
  187. </div>
  188. <div class="modal-body" id="raw_html_supported">
  189. <p> <div id="errors-modal"></div><br>Website Source<br>
  190. <textarea id="existing-content" style="margin: 0px 0px 10px; height: 174px; width: 517px;" name="existing-content"></textarea>
  191. </p>
  192. </div>
  193. <div class="modal-footer">
  194. <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  195. <button onclick="loadexisting()" class="btn btn-primary">Create</button>
  196. </div>
  197. </div>
  198. <div id="core-wrapper">
  199. </div>
  200. <script src="http://localhost/design/js/bootstrap.js"></script>
  201. </body>
  202. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement