var dbEndPoint = "couchdb.php" var smnOptions = { dialogsInBody: true, airMode: false, popover: { air: [ //['color', ['color']], ['color', ['DVColor']], ['fontname', ['fontname']], ['fontsize', ['fontsize']], ['font', ['bold', 'underline', 'italic', 'clear']], ['para', ['ul', 'paragraph']], //['table', ['table']], //['insert', ['link', 'picture']] ['insert', ['DVLink']], ['custom', ['DVCodeViewPlugin']], ], link: [ //['link', ['linkDialogShow', 'unlink']], ['link', ['DVLink', 'unlink']], ['custom', ['DVCodeViewPlugin']], ], table: [ ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']], ['delete', ['deleteRow', 'deleteCol', 'deleteTable']], ['custom', ['DVCodeViewPlugin']], ], image: [ ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']], ['float', ['floatLeft', 'floatRight', 'floatNone']], ['remove', ['removeMedia']], ['image',['url']], //['change', ['changeImage']], ['custom', ['DVCodeViewPlugin','DVImageUpload','DVImageGallery']], /*['test', ['test']]*/ ] }, // Add more font size fontSizes: ['8', '9', '10', '11', '12', '13', '14', '16', '18', '20', '22', '24', '26', '28', '30', '34', '36', '40', '46', '48', '52'], buttons: { changeImage: changeImageButton, /*test: testButton*/ } }; /* remove [] */ function prettyStudioErrorMessage(str) { str = str.replace("[i]", ""); return str; } function getParameterByName_old(name){ name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.search); if(results == null) return ""; else return decodeURIComponent(results[1].replace(/\+/g, " ")); } function getCurrentDateTime() { return UTCDateTime(); } function UTCDateTime(){ var d = new Date(); return moment(d).utc().format("YYYY-MM-DD[T]HH:mm:ss[Z]"); // WHO WROTE THIS? You're the ghost in the machine! Should be HH not hh } function UTCDateTimeMDT(){ var d = new Date(); return moment(d).utc().format("MM/DD/YYYY"); } function ShowScheduleDateTime(datetime) { var a = moment(datetime); datetime = a.format('dddd MMMM DD YYYY [at] h:mm a'); return datetime; } function convertTime(timeString) { var hourEnd = timeString.indexOf(":"); var H = +timeString.substr(0, hourEnd); var h = H % 12 || 12; var ampm = H < 12 ? ":00 AM" : ":00 PM"; timeString = h + timeString.substr(hourEnd, 3) + ampm; return timeString; // return adjusted time or original string } function convertTimeFormat(timeString) { if (hasValue(timeString)) { timeString = timeString.replace("PM", ":00 PM"); timeString = timeString.replace("AM", ":00 AM"); } else { timeString = ""; } return timeString; } function formatDate(date) { var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var day = date.getDate(); var monthIndex = date.getMonth(); var year = date.getFullYear(); return day + ' ' + monthNames[monthIndex] + ' ' + year; } function getMomentTimezone(tz) { if (tz == 'Pacific Standard Time') { return 'America/Los_Angeles'; } if (tz == 'Mountain Standard Time') { return 'America/Denver'; } if (tz == 'Central Standard Time') { return 'America/Chicago'; } if (tz == 'Eastern Standard Time') { return 'America/New_York'; } if (tz == 'SE Asia Standard Time') { return 'Asia/Bangkok'; } } /*function checkdate(datetime1, timezone1){ if(datetime1 == null || datetime1 == 'undefined'){ return false; }else{ timezone1 = getMomentTimezone(timezone1); // Create date from input value var tz1 = moment(datetime1).tz(timezone1).format('Z'); var inputDate = new Date(datetime1+tz1); //alert(inputDate); // Get today's date var todaysDate= new Date(); //alert(todaysDate); if (inputDate < todaysDate) { //alert('past date'); return false; } else { //alert('ok'); return true; } } }*/ function convertUSDTtoMMDT(usDateTime) { var usDateTime_split = usDateTime.split(" "); var convertDate = function(usDate) { var dateParts = usDate.split(/(\d{1,2})\/(\d{1,2})\/(\d{4})/); return dateParts[3] + "-" + dateParts[1] + "-" + dateParts[2]; } mmDate = convertDate(usDateTime_split[0]); mmTime = convert_to_24h(usDateTime_split[1]+' '+usDateTime_split[2]); return mmDate+' '+mmTime; } function checkdate(datetime1, timezone1){ if(datetime1 == null || datetime1 == 'undefined'){ return false; }else{ timezone1 = getMomentTimezone(timezone1); datetime1 = convertUSDTtoMMDT(datetime1) var tz1 = moment(datetime1).tz(timezone1).format('Z'); //alert(datetime1+tz1); var inputDate = moment(datetime1+tz1).toDate(); //alert(inputDate); // Get today's date var todaysDate= new Date(); //alert(todaysDate); if (inputDate < todaysDate) { //alert('past date'); return false; } else { //alert('ok'); return true; } } } function comparedate(datetime1, timezone1, datetime2, timezone2){ timezone1 = getMomentTimezone(timezone1); timezone2 = getMomentTimezone(timezone2); //alert(datetime1+','+timezone1+','+datetime2+','+timezone2); //time1 = convert_to_24h(convertTimeFormat(time1)); // Create date from input value var tz1 = moment(datetime1).tz(timezone1).format('Z'); var Date1 = new Date(datetime1+tz1); //alert(Date1); // Get today's date var tz2 = moment(datetime2).tz(timezone2).format('Z'); var Date2 = new Date(datetime2+tz2); //alert(Date2); if (Date1 < Date2) { //alert('ok'); return true; } else { //alert('past date'); return false; } } function convert_to_24h(time_str) { // Convert a string like 10:05:23 PM to 24h format, returns like [22,5,23] var time = time_str.match(/(\d+):(\d+):(\d+) (\w)/); var hours = Number(time[1]); var minutes = Number(time[2]); var seconds = Number(time[3]); var meridian = time[4].toLowerCase(); if (meridian == 'p' && hours < 12) { hours += 12; } else if (meridian == 'a' && hours == 12) { hours -= 12; } return str_pad(hours)+':'+str_pad(minutes)+':'+str_pad(seconds); }; /* Remove JSONP Style Call back data (xxxxxxxx) -> xxxxxxx */ function clearCallBack(data){ var len = data.length; if(data.charAt(0) == '('){ return data.substring(1, len-1); }else{ return data; } }; String.prototype.startsWith = function(needle) { return(this.indexOf(needle) == 0); }; String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; function RenderNoSharpSharp(template,data){ var reg = /\{{(.*?)\}}/; var html = template; while (match = reg.exec(html)) { var slugPattern = match[0]; var slug = match[1]; var renderRaw = false; if(slug.startsWith("RAW ")){ renderRaw = true; slug = slug.substring(4); } if(slug.startsWith("SUMMERNOTE(")){ slug = slug.substring(11); slug = slug.replace(")", ""); } if(slug.startsWith("SUMMERNOTETEXT(")){ slug = slug.substring(15); slug = slug.replace(")", ""); } html = html.replace(slugPattern,data[slug]); console.log(slug); } return html; } function Render(template,data){ //Kwang Refactor /*var reg = /\{{(.*?)\}}/; var html = template; while (match = reg.exec(html)) { var slugPattern = match[0]; var slug = match[1]; var renderRaw = false; if(slug.startsWith("RAW ")){ renderRaw = true; slug = slug.substring(4); } if(slug.startsWith("SUMMERNOTE(")){ slug = slug.substring(11); slug = slug.replace(")", ""); } if(slug.startsWith("SUMMERNOTETEXT(")){ slug = slug.substring(15); slug = slug.replace(")", ""); } html = html.replace(slugPattern,data[slug]); console.log(slug); }*/ var html = RenderNoSharpSharp(template,data); html = RenderSharpSharpWithS3URL(html,data['accountID']); return html; } function Render2(template,data){ var reg = /\{{(.*?)\}}/; var html = template; while (match = reg.exec(html)) { var slugPattern = match[0]; var slug = match[1]; var renderRaw = false; if(slug.startsWith("RAW ")){ renderRaw = true; slug = slug.substring(4); } if(slug.startsWith("SUMMERNOTE(")){ slug = slug.substring(11); slug = slug.replace(")", ""); } if(slug.startsWith("SUMMERNOTETEXT(")){ slug = slug.substring(15); slug = slug.replace(")", ""); } if(typeof data[slug] == 'undefined'){ console.log("Undefine " + slug); if(renderRaw){ html = html.replace(slugPattern,"((RAW " + slug + "))"); }else{ html = html.replace(slugPattern,"((" + slug + "))"); } }else{ html = html.replace(slugPattern,data[slug]); console.log("Define " + slug); } } html = html.replace(/\(\(/g,"{{"); html = html.replace(/\)\)/g,"}}"); html = RenderSharpSharpWithS3URL(html,data['accountID']); return html; } function RenderSharpSharpWithS3URL(template,acctID){ var s3URL = "##URL SRC=\"https://mfdavinci.s3.amazonaws.com/file/{{ACCTID}}-{{FIELDNAME}}.html\"##"; var reg = /##(def[^#]+)##/; var html = template; while (match = reg.exec(html)) { var slugPattern = match[0]; var slug = match[1]; var sharpsharpData = s3URL.replace("{{ACCTID}}",acctID); sharpsharpData = sharpsharpData.replace("{{FIELDNAME}}",slug); html = html.replace(slugPattern,sharpsharpData); console.log(sharpsharpData); } return html; } function RenderSharpSharp(template,data){ //var s3URL = "##URL SRC=\"https://mfdavinci.s3.amazonaws.com/file/{{ACCTID}}-{{FIELDNAME}}.html\"##"; var reg = /##(def[^#]+)##/; var html = template; while (match = reg.exec(html)) { var slugPattern = match[0]; var slug = match[1]; //var sharpsharpData = s3URL.replace("{{ACCTID}}",acctID); //sharpsharpData = sharpsharpData.replace("{{FIELDNAME}}",slug); html = html.replace(slugPattern,data[slug]); console.log(data[slug]); } return html; } function MergeByStartWith(target,src,startWithValue) { var keys = Object.keys(src); //console.log(keys); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if(key.startsWith(startWithValue)){ target[key] = src[key]; } } } function documentConpare(obj1, obj2) { if(typeof obj1 == "undefined"){ return false; } if(typeof obj2 == "undefined"){ return false; } //Loop through properties in object 1 for (var p in obj1) { switch (typeof (obj1[p])) { //Deep compare objects case 'object': if(typeof obj2[p] == "undefined"){ console.log("object differ " + p); return false; } if (!documentConpare(obj1[p], obj2[p])) { console.log("object differ " + p); return false; } break; //Compare function code case 'function': continue; //Compare values default: if(typeof obj2[p] == "undefined"){ console.log("prop differ " + p); return false; } if (obj1[p] != obj2[p]) { console.log("prop differ " + p); return false; } } } return true; }; function getEmailName(emailName,mode,campaignType) { if (mode == 'long') { if (campaignType == 'PromoteBlog') { if (emailName == 'Email1') { emailName = 'Email #1: Sent to Everyone'; } else if (emailName == 'Email2') { emailName = 'Email #2: Sent to Non-Openers'; } else if (emailName == 'Email3') { emailName = 'Email #3: Sent to Non-Clickers'; } } else { if (emailName == 'Email1') { emailName = 'Email #1: Sent to Everyone Who Downloads'; } else if (emailName == 'Email2') { emailName = 'Email #2: Sent to Everyone Who Downloads'; } } } else if (mode == 'short') { if (emailName == 'Email1') { emailName = 'Email #1'; } else if (emailName == 'Email2') { emailName = 'Email #2'; } else if (emailName == 'Email3') { emailName = 'Email #3'; } } return emailName; } function addDays(theDate, days) { return new Date(theDate.getTime() + days * 24 * 60 * 60 * 1000); } function addMinutes(theDate, mins) { return new Date(theDate.getTime() + mins * 60 * 1000); } function toDate(dateStr) { var parts1 = dateStr.split(" "); var parts2 = parts1[0].split("/"); return new Date(parts2[2], parts2[0] - 1, parts2[1]); } function formatDateMDY(date) { var year = date.getFullYear(); month = date.getMonth() + 1; // months are zero indexed day = date.getDate(); return str_pad(month) + "/" + str_pad(day) + "/" + year; } function str_pad(n) { return String("0" + n).slice(-2); } function removeChar(s,r) { s = (s.length && s[0] == r) ? s.slice(1) : s; return s; } var changeImageButton = function (context) { var ui = $.summernote.ui; // create button var button = ui.button({ contents: '', //contents: '
Upload
', tooltip: 'Change', click: function () { // invoke insertText method with 'hello' on editor module. //context.invoke('editor.insertText', 'hello'); //var editor = $.summernote.eventHandler.getEditor(); //editor.insertImage($('.note-editable'), "http://162.243.155.57:5985/_utils/image/logo.png"); //alert('1'); //var imgNode = $('').attr('src', "http://162.243.155.57:5985/_utils/image/logo.png")[0]; //context.invoke('code',""); //context.invoke('editor.insertNode', imgNode); //context.triggerEvent('image.upload'); //$scope.imageUpload //context.invoke('code',''); //Only workwith custom version of summernote summerNoteURLInserting = true; context.invoke('imageDialog.show'); } }); return button.render(); // return button as jquery object } var testButton = function (context) { var ui = $.summernote.ui; // create button var button = ui.button({ contents: '', //contents: '
Upload
', tooltip: 'Change', click: function () { // invoke insertText method with 'hello' on editor module. context.invoke('editor.insertText', 'hello'); //var editor = $.summernote.eventHandler.getEditor(); //editor.insertImage($('.note-editable'), "http://162.243.155.57:5985/_utils/image/logo.png"); //alert('1'); //var imgNode = $('').attr('src', "http://162.243.155.57:5985/_utils/image/logo.png")[0]; //context.invoke('code',""); //context.invoke('editor.insertNode', imgNode); //context.triggerEvent('image.upload'); //$scope.imageUpload //context.invoke('code',''); //context.invoke('imageDialog.show'); } }); return button.render(); // return button as jquery object } function downloadFromURL($http,httpPath) { $http.get(httpPath, { responseType: 'arraybuffer' }) .then( function(response) { var data = response.data; var status = response.status; var headers = response.headers(); var octetStreamMime = 'application/octet-stream'; var success = false; // Get the headers //headers = headers(); // Get the filename from the x-filename header or default to "download.bin" var filename = headers['x-filename'] || 'download.bin'; // Determine the content type from the header or default to "application/octet-stream" var contentType = headers['content-type'] || octetStreamMime; try { // Try using msSaveBlob if supported console.log("Trying saveBlob method ..."); var blob = new Blob([data], { type: contentType }); if(navigator.msSaveBlob) navigator.msSaveBlob(blob, filename); else { // Try using other saveBlob implementations, if available var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; if(saveBlob === undefined) throw "Not supported"; saveBlob(blob, filename); } console.log("saveBlob succeeded"); success = true; } catch(ex) { console.log("saveBlob method failed with the following exception:"); console.log(ex); } if(!success) { // Get the blob url creator var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; if(urlCreator) { // Try to use a download link var link = document.createElement('a'); if('download' in link) { // Try to simulate a click try { // Prepare a blob URL console.log("Trying download link method with simulated click ..."); var blob = new Blob([data], { type: contentType }); var url = urlCreator.createObjectURL(blob); link.setAttribute('href', url); // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) link.setAttribute("download", filename); // Simulate clicking the download link var event = document.createEvent('MouseEvents'); event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); link.dispatchEvent(event); console.log("Download link method with simulated click succeeded"); success = true; } catch(ex) { console.log("Download link method with simulated click failed with the following exception:"); console.log(ex); } } if(!success) { // Fallback to window.location method try { // Prepare a blob URL // Use application/octet-stream when using window.location to force download console.log("Trying download link method with window.location ..."); var blob = new Blob([data], { type: octetStreamMime }); var url = urlCreator.createObjectURL(blob); window.location = url; console.log("Download link method with window.location succeeded"); success = true; } catch(ex) { console.log("Download link method with window.location failed with the following exception:"); console.log(ex); } } } } if(!success) { // Fallback to window.open method console.log("No methods worked for saving the arraybuffer, using last resort window.open"); window.open(httpPath, '_blank', ''); } }, function(response) { console.log("Request failed with status: " + response.status); }); } function downloadFromField($http,fieldName,fileName) { var httpPath = "downloadLandingPage.php?progID=" + campaignID + "&fieldName=" + encodeURIComponent(fieldName) + "&fileName=" + encodeURIComponent(fileName); downloadFromURL($http,httpPath); } function downloadForm($http,formID,fileName) { var httpPath = "downloadForm.php?formID=" + formID + "&fileName=" + encodeURIComponent(fileName); downloadFromURL($http,httpPath); } function hasValue(obj, defaultValue) { if (obj === undefined || obj == '' || obj == null) { return false; } else { //make sure that it is not default if provided if (defaultValue === undefined) {} else { if (obj == defaultValue) { return false; } } return true; } } function ObjecttoParams(obj) { var p = []; for (var key in obj) { p.push(key + '=' + encodeURIComponent(obj[key])); } return p.join('&'); }; function MapTrueFalse(obj, trueValue, falseValue) { if (obj == true) { return trueValue; } else { return falseValue; } } function isValidEmailAddress(emailAddress) { var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i); return pattern.test(emailAddress); }; function ScopeImageUpload($scope,Upload,files, editor) { var uploadFileName = "IMG-" + uuidv4(); //$scope.editor.summernote('insertNode', imgNode); Upload.upload({ url: 'upload.php', method: 'POST', file: files[0], data: { file: files[0], 's3': 'true', 'fileName': uploadFileName, 'acctID': 'accountID', 'progID': 'programID', } }).then(function(resp) { console.log('Success ' + resp.config.data.file.name + 'uploaded'); console.log(resp.data); console.log(editor); var imgNode = $('').attr('src', resp.data.imgSrc)[0]; //$scope[editor].summernote('code',''); $scope[editor].summernote('insertNode', imgNode); }, function(resp) { console.log('Error status: ' + resp.status); }, function(evt) { var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name); }); }; function myTrim(x) { return x.replace(/^\s+|\s+$/gm,''); } function validateURL(value) { return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); } /* function SaveAssetUsed(dataSet) { //var json2 = JSON2.stringify(dataSet ); var json1 = JSON.stringify(dataSet); //var param = $.param(dataSet) var phpURL = 'fileManagerCallDBS3FileDesc.php?cmd=test&acctID='+dataSet[0].accountID+'&assetUsed='+json1; $.getJSON({ url: phpURL, type: 'post', data:json1, contentType: "application/json; charset=utf-8", datatype:'json', success: function(json){ var ret = json.data; return json; } }); } */ function SaveAssetUsed(accountID, campaignID, dataSet) { var pages = ''; var assetsID = ''; var assetsCnt = dataSet.length; for (var i=0;i').text(data).html(); } function HtmlDecode(data) { return $('
').html(data).text(); } function GetAllParent(node) { var a = node; var els = []; while (a) { els.unshift(a); a = a.parentNode; } return els; } function HasAttribute(list,name,value) { for(i=0;i').parent().html(); } /* function SummernoteSetImagetargetAttr(editor,name,value) { //var imgNode = $('').attr('src', value)[0]; //imgNode.className = "img-responsive"; //editor.summernote('code',''); //editor.summernote('insertNode', imgNode); var target = editor.summernote('editor.get','uploadTarget'); target.attr(name,value); target.addClass('img-responsive'); editor.summernote('code',editor.summernote('code')); } */ function SummernoteUpdateUploadImage(editor,prop) { var target = editor.summernote('editor.get','uploadTarget'); SummernoteSetImage(target,prop); //Refresh code editor.summernote('code',editor.summernote('code')); } function SummernoteSetImage(img,prop) { img.attr("src",prop); img.addClass('img-responsive'); } function getUrlParameter(url,name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(url); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); }; function GetGoogleFontInstalled() { var links = []; $("link").each(function(index){ var link = $(this); //console.log(link); var href = link.attr("href"); if(href.startsWith("http://fonts.googleapis.com/css?")){ var family = getUrlParameter(href,"family"); links.push( { "family": family, "link": link, } ); } }); return links; } function IsGoogleFontInstalled(fontName) { var found = false; var links = GetGoogleFontInstalled(); $.each(links, function(index, item) { if(item.family == fontName){ found = true; return false; } }) return found; } function getAllImages(accountID) { var retArray = []; var phpURL = 'fileManagerCallDBAssetDir.php?cmd=Get&acctID='+accountID; $.getJSON({ url: phpURL, type: 'get', async: false, success: function(json){ var folderTree = json.ret; console.log(json); //find folder first var folderID = ''; for(var k=0;k'; } return gallery_code; }