false "; document.execCommand('insertHtml', false,share); document.designMode = "off"; }); $('body').on('click','#source_submit',function(){ var thehtml = document.getElementById("source_text").value; fireinsertHtml(thehtml); document.getElementById('source_text').value = ''; $('.source').hide(); $('#source_submit').hide(); $('.hnd-close').trigger('click'); }); $('body').on('mousedown','.hnd-bold',function(){ document.designMode = "on"; document.execCommand('bold', false,null); document.designMode = "off"; }); $('body').on('mousedown','.hnd-underline',function(){ document.designMode = "on"; document.execCommand('underline', false,null); document.designMode = "off"; }); $('body').on('mousedown','.hnd-h1',function(){ document.designMode = "on"; document.execCommand('heading', false, 'H1'); document.designMode = "off"; }); $('body').on('mousedown','.hnd-h2',function(){ document.designMode = "on"; document.execCommand('heading', false, 'H2'); document.designMode = "off"; }); $('body').on('click','.hnd-save',function(){ count_click = 1; $('span.hnd-edit-holder').attr('contentEditable',false); $('span.hnd-edit-holder').attr('designMode',false); $('span.hnd-edit-holder').css('border-width','0px'); //current_selected.html( $('#hnd-bubble-text').html()); $('#hnd-bubble').hide(); $('#hnd-publish-template').show(); }); // on close button current tab of browser will be close $('body').on('click','#close_button',function(){ var close_window = confirm("Are you really want to close the current tab of browser?"); if(close_window) { window.top.close(); } else { return false; } }); $('body').on('click','#hnd-publish-template',function(){ var rhtml = $("html").html(); count_click=0; $(this).val('Wait...'); $('span.hnd-edit-holder').each(function(){ //$(this).parent().html($(this).html()); }); var html = $('html').html(); var data = { html: html, rhtml: rhtml, user_id:18522, s_folder:'sites/18522/13622', subdomain:'richman', domain_id:5 }; $.ajax({ url:'process_template.php', data: data, type:'post', success:function(data){ alert('Your data has been save successfully'); //success message on publish window.location.reload(); /*window.location = 'http://www.millionairebizpro.com/amembercp/member';*/ } }); }); $('span.hnd-edit-holder').click(function(){ //ind = window.getSelection().getRangeAt(0).startOffset; //alert(ind); //end = window.getSelection().getRangeAt(0).endOffset; $(this).attr('contentEditable',true); $(this).attr('designMode','on'); $(this).css('border-width','2px'); $(this).css('border-style','solid'); $(this).css('display','block'); //$(this).css('min-width','534px'); current_selected = $(this); var html = $(this).html(); var offset = $(this).offset(); var width= $(this).width(); var height = $(this).height() + 100; $('#hnd-bubble').width(width); $('#hnd-bubble').height(200); $('#hnd-bubble').css('top',offset.top - 200 ); $('#hnd-bubble').css('left',offset.left - 50); //$('#hnd-bubble-text').html(html); $('#hnd-bubble').show(); $('#hnd-publish-template').hide(); }); window.onbeforeunload = function() { $('#hnd-publish-template').val('Save Changes'); if(count_click==1) { return "do you want to save edited data" } };