Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
- <!-- Le styles -->
- <link href="http://localhost/design/css/bootstrap.css" rel="stylesheet">
- <link href="http://localhost/design/css/bootstrap-responsive.css" rel="stylesheet">
- <script>
- function setCookie(c_name,value,exdays)
- {
- var exdate=new Date();
- exdate.setDate(exdate.getDate() + exdays);
- var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
- document.cookie=c_name + "=" + c_value;
- }
- function getCookie(c_name)
- {
- var c_value = document.cookie;
- var c_start = c_value.indexOf(" " + c_name + "=");
- if (c_start == -1)
- {
- c_start = c_value.indexOf(c_name + "=");
- }
- if (c_start == -1)
- {
- c_value = null;
- }
- else
- {
- c_start = c_value.indexOf("=", c_start) + 1;
- var c_end = c_value.indexOf(";", c_start);
- if (c_end == -1)
- {
- c_end = c_value.length;
- }
- c_value = unescape(c_value.substring(c_start,c_end));
- }
- return c_value;
- }
- function addnewdiv() {
- var fc = $("#fcolor").val();
- var width = $("#width").val();
- var height = $("#height").val();
- var bg = $("#bgcolor").val();
- var divname = $("#divname").val();
- var divstyle = 'color:'+fc+'; width:'+width+'; height:'+height+'; background-color:'+bg+';';
- var mynewdiv = '<div id="'+divname+'" class="'+divname+'" style="'+divstyle+'"><p id="content-'+divname+'"></p></div>';
- if(divname=='') {
- $("#errors-modal").html('<font color="red">Error: Div name required</font><br>');
- } else {
- $("#core-wrapper").append(mynewdiv);
- $("#"+divname).draggable();
- addeditmount(divname);
- $("#modal-newdiv").modal('hide');
- $("#divname").val('');
- }
- }
- function addeditmount(p_id) {
- var pfun = "'"+p_id+"'";
- $("#"+p_id).prepend('<button id="edit_content" onclick="addcookiesbro('+pfun+')" type="button" data-toggle="modal" data-target="#modal-editcontent">Edit content</button>');
- var text_content_one = $("#content-"+p_id).text();
- $("#edit_content").click(function() { $("#content-new").val(text_content_one); });
- }
- $(document).ready(function(){$('#modal-editcontent').on('shown', function() { getcontentbro(); });});
- function getcontentbro() {
- var gc = getCookie("editing_id");
- $("#content-new").val($("#content-"+gc).html());
- }
- function addcookiesbro(p_id) {
- setCookie("editing_id",p_id);
- }
- function updatecontent(p_id) {
- var newtext = $("#content-new").val();
- $("#content-"+p_id).html(newtext);
- $("#para").html('');
- $("#content-new").val('');
- $("#modal-editcontent").modal('hide');
- }
- function loadcssforme() {
- $("#css").html($("#custom_css").html().trim());
- }
- function updatecss() {
- $("#custom_css").html($("#css").val());
- $("#modal-editcss").modal('hide');
- }
- function redesignsite() {
- $("div").each(function() { $(this).draggable(); });
- $("a").each(function() { $(this).draggable(); });
- $("ul").each(function() { $(this).draggable(); });
- $("li").each(function() { $(this).draggable(); });
- $("img").each(function() { $(this).draggable(); });
- $("button").each(function() { $(this).draggable(); });
- $("input").each(function() { $(this).draggable(); });
- $("p").each(function() { $(this).draggable(); });
- $("b").each(function() { $(this).draggable(); });
- $("tr").each(function() { $(this).draggable(); });
- $("td").each(function() { $(this).draggable(); });
- }
- function loadexisting() {
- $("#core-wrapper").html($("#existing-content").val());
- $("#modal-exitexisting").modal('hide');
- redesignsite();
- }
- </script>
- </head>
- <body>
- <style id="custom_css">
- </style>
- <div id="design-unit">
- <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>
- </div>
- <div id="modal-newdiv" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
- <h3 id="myModalLabel">Create new div</h3>
- </div>
- <div class="modal-body">
- <p> <div id="errors-modal"></div>
- Div Name: <input id="divname" type="text" name="divname" value="" required><br>
- Font colour: <input id="fcolor" type="text" name="fcolor" value="#FFFFFF"><br>
- Width: <input id="width" type="text" name="width" value="100px"><br>
- Height: <input id="height" type="text" name="height" value="100px"><br>
- BG Color: <input id="bgcolor" type="text" name="" value="#000000"><br>
- </p>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button onclick="addnewdiv()" class="btn btn-primary">Create</button>
- </div>
- </div>
- <div id="modal-editcontent" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
- <h3 id="myModalLabel">Edit Paragraph Content</h3>
- </div>
- <div class="modal-body" id="raw_html_supported">
- <p> <div id="errors-modal"></div><br><div style="display:none;" id="para"></div>
- <b>RAW HTML Supported</b>
- <textarea id="content-new" name="content-new">
- </textarea>
- </p>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button onclick="updatecontent(getCookie('editing_id'))" class="btn btn-primary">Create</button>
- </div>
- </div>
- <div id="modal-editcss" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
- <h3 id="myModalLabel">Edit Paragraph Content</h3>
- </div>
- <div class="modal-body" id="raw_html_supported">
- <p> <div id="errors-modal"></div><br><script>getcontentbro();</script>
- <textarea id="css" style="margin: 0px 0px 10px; height: 174px; width: 517px;" name="css"></textarea>
- </p>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button onclick="updatecss()" class="btn btn-primary">Create</button>
- </div>
- </div>
- <div id="modal-editcontent" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
- <h3 id="myModalLabel">Edit Paragraph Content</h3>
- </div>
- <div class="modal-body" id="raw_html_supported">
- <p> <div id="errors-modal"></div><br><div style="display:none;" id="para"></div>
- <b>RAW HTML Supported</b>
- <textarea id="content-new" name="content-new">
- </textarea>
- </p>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button onclick="updatecontent(getCookie('editing_id'))" class="btn btn-primary">Create</button>
- </div>
- </div>
- <div id="modal-exitexisting" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
- <h3 id="myModalLabel">Edit Existing Website</h3>
- </div>
- <div class="modal-body" id="raw_html_supported">
- <p> <div id="errors-modal"></div><br>Website Source<br>
- <textarea id="existing-content" style="margin: 0px 0px 10px; height: 174px; width: 517px;" name="existing-content"></textarea>
- </p>
- </div>
- <div class="modal-footer">
- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
- <button onclick="loadexisting()" class="btn btn-primary">Create</button>
- </div>
- </div>
- <div id="core-wrapper">
- </div>
- <script src="http://localhost/design/js/bootstrap.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement