diff --git a/src/css/builder.css b/src/css/builder.css index 68db9770..c9aa4526 100644 --- a/src/css/builder.css +++ b/src/css/builder.css @@ -950,8 +950,6 @@ div.propertyItems label[for|=id] { } .ribDialog { - background-color: transparent; - background-color: rgba(21, 28, 34, 0.85); padding: 0; margin: 0; display: block; @@ -959,19 +957,51 @@ div.propertyItems label[for|=id] { border-radius: 8px; -webkit-background-clip: padding-box; background-clip: padding-box; - font-size: 14px; - font-family: OpenSans-SB; - font-weight: 600; /* semi-bold */ - font-color: #333; - } .ui-dialog { padding: 0px; } .ui-dialog .ui-dialog-content{ padding: 0px; + font-size: 14px; + font-family: OpenSans-SB; + font-weight: 600; /* semi-bold */ + font-color: #333; } +.ui-dialog .buttonStyle{ + display: inline-block; + font-size: 12px; + text-align: center; + color: #424242; + border: 1px solid #a1a1a1; + line-height: 12px; + padding: 8px 20px 7px 20px; + background-color: #fbfbfb; + background-image: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#ececec)); + background-image: -webkit-linear-gradient(top, #fbfbfb, #ececec); + background-image: -moz-linear-gradient(top, #fbfbfb, #ececec); + background-image: -ms-linear-gradient(top, #fbfbfb, #ececec); + background-image: -o-linear-gradient(top, #fbfbfb, #ececec); + background-image: linear-gradient(to bottom, #fbfbfb, #ececec); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -moz-background-clip: padding; -webkit-background-clip: padding-box; + background-clip: padding-box; + text-decoration: none; +} +.ui-dialog .buttonStyle:hover { + color: #eee; + background-color: #cccccc; + border-color: #424242; + background-image: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#777777)); + background-image: -webkit-linear-gradient(top, #cccccc, #777777); + background-image: -moz-linear-gradient(top, #cccccc, #777777); + background-image: -ms-linear-gradient(top, #cccccc, #777777); + background-image: -o-linear-gradient(top, #cccccc, #777777); + background-image: linear-gradient(to bottom, #cccccc, #777777); +} .ribDialog > div { -webkit-border-radius: 12px; margin: 0px; @@ -1098,39 +1128,8 @@ div.propertyItems label[for|=id] { float: right; } .ribDialog .buttonStyle { - display: block; width: 60px; height: 12px; - font-size: 12px; - text-align: center; - color: #424242; - border: 1px solid #a1a1a1; - line-height: 12px; - padding: 8px 20px 7px 20px; - background-color: #fbfbfb; - background-image: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#ececec)); - background-image: -webkit-linear-gradient(top, #fbfbfb, #ececec); - background-image: -moz-linear-gradient(top, #fbfbfb, #ececec); - background-image: -ms-linear-gradient(top, #fbfbfb, #ececec); - background-image: -o-linear-gradient(top, #fbfbfb, #ececec); - background-image: linear-gradient(to bottom, #fbfbfb, #ececec); - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; - -moz-background-clip: padding; -webkit-background-clip: padding-box; - background-clip: padding-box; - text-decoration: none; -} -.ribDialog .buttonStyle:hover { - color: #eee; - background-color: #cccccc; - border-color: #424242; - background-image: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#777777)); - background-image: -webkit-linear-gradient(top, #cccccc, #777777); - background-image: -moz-linear-gradient(top, #cccccc, #777777); - background-image: -ms-linear-gradient(top, #cccccc, #777777); - background-image: -o-linear-gradient(top, #cccccc, #777777); - background-image: linear-gradient(to bottom, #cccccc, #777777); } .ribDialog .linkStyle { background: none !important; @@ -1327,26 +1326,25 @@ div.propertyItems label[for|=id] { margin-top: 2em } .deviceSetting input { - margin-top: 2em + margin-top: 2em; + margin-left: 1em; + margin-right: 1em; } - - -.deviceSetting input.submit -{ - margin-left: 10px; - margin-right: 23px; - min-width: 110px; +.deviceSetting input[type='number'] { + width:5em; + size: 4; } -.deviceSetting input.submit.single{ - margin-left: 143px; +.deviceSetting #buttonSet{ + position: absolute; + bottom: 0px; + width: 100%; } - -.deviceSetting input.delete -{ - margin-left: 23px; - min-width: 110px; +.deviceSetting #buttonSet * { + margin: 0 1em 3em 1em; + min-width: 25%; } + .rotateDevice { cursor: pointer; padding: 20px; @@ -1423,3 +1421,9 @@ input.screenCoordinate::-webkit-inner-spin-button { top: -1em; left: -1em; } +#exportDialog { + padding: 0.8em 1.2em; +} +#exportDialog .buttonStyle { + margin: 0 0.6em; +} diff --git a/src/js/serialize.js b/src/js/serialize.js index b015012b..ea17ea6b 100644 --- a/src/js/serialize.js +++ b/src/js/serialize.js @@ -268,7 +268,6 @@ function dumplog(loginfo){ $(function() { - /******************************************************* * JSON to ADM Direction ******************************************************/ @@ -380,12 +379,14 @@ $(function() { * This function is to find valid design.json in imported file and build ADMTree according it */ function zipToProj(data) { - var zip, designData; + var zip, designData, ribRule; + // Accept file subffixed with ".json" or ".rib" + ribRule = /\.(json|rib)$/i; try { zip = new ZipFile(data); zip.filelist.forEach(function(zipInfo, idx, array) { - // if find a file name contians "json" then get its data - if (zipInfo.filename.indexOf("json") !== -1) { + // use file suffixed with ".json" or ".rib", case insensitive + if (ribRule.test(zipInfo.filename)) { designData = zip.extract(zipInfo.filename); } }); @@ -522,74 +523,101 @@ $(function() { return $.rib.designHeaders; } - function exportFile (fileName, content, binary) { - var cookieValue = $.rib.cookieUtils.get("exportNotice"), - $exportNoticeDialog = createExportNoticeDialog(), - saveAndExportFile = function () { - $.rib.fsUtils.write(fileName, content, function(fileEntry){ - $.rib.fsUtils.exportToTarget(fileEntry.fullPath); - }, null, false, binary); - }; - - if(cookieValue === "true" && $exportNoticeDialog.length > 0) { - // bind exporting HTML code handler to OK button - $exportNoticeDialog.dialog("option", "buttons", { - "OK": function () { - saveAndExportFile(); - $("#exportNoticeDialog").dialog("close"); - } - }); - // open the dialog - $exportNoticeDialog.dialog("open"); - } else { - // if cookieValue is not true, export HTML code directly - saveAndExportFile(); - } - } - // create a notice Dialog for user to configure the browser, so that // a native dialog can be shown when exporting design or HTML code - function createExportNoticeDialog () { - var dialogStr, dialogOpts, $exportNoticeDialog, cookieExpires; + function createExportDialog () { + var dialogOpts, exportTypes, exportDialog, cookieExpires, + exportMenu, cancelDiv, configNotice, checkbox; + exportTypes = ['zip', 'json', 'wgt']; cookieExpires = new Date("January 1, 2042"); - dialogStr = '
'; - dialogStr += 'Note: Files will be saved in the default download path of the Browser.'; - dialogStr += '

To configure the Browser to ask you to where to save files, go to:
'; - dialogStr += 'Preferences -> Under the Hood -> Download

'; - dialogStr += '

Then check the box "Ask where to save each file before downloading"

'; - dialogStr += '

Do not remind me again

'; - dialogStr += '
'; dialogOpts = { - autoOpen: false, + autoOpen: true, modal: true, width: 500, resizable: false, - height: 400, - title: "RIB", + height: 150, + title: "Export" }; - $(dialogStr).dialog(dialogOpts); - $exportNoticeDialog = $("#exportNoticeDialog"); - if($exportNoticeDialog.length <= 0) { - console.error("create saveAlertDialog failed."); - return null; - } - $exportNoticeDialog.find("input:checkbox").click(function () { - var notice = this.checked ? "false" : "true"; - // set cookie - if(!$.rib.cookieUtils.set("exportNotice", notice, cookieExpires)) { - console.error("Set exportNotice cookie failed."); - } + exportDialog = $('
').addClass("vbox"); + + // If user haven't checked "Do not remind again", then show the notice + if ($.rib.cookieUtils.get("exportNotice") !== "false") { + // Resize the dialog + dialogOpts.height *= 2; + // Add configure notice + configNotice = $('
').appendTo(exportDialog); + $('

Note: File will be saved in the default download path.

' + + '
Please configure the browser to ask for saving location,
' + + 'for Chrome, go to Settings: chrome://chrome/settings/
' + + 'and check the option to be asked where to save download files.
' + + '

 Do not remind me again
' + ).appendTo(configNotice); + checkbox = configNotice.find('input:checkbox'); + checkbox.change(function () { + var notice = this.checked ? "false" : "true"; + // set cookie + if(!$.rib.cookieUtils.set("exportNotice", notice, cookieExpires)) { + console.error("Set exportNotice cookie failed."); + } + }); + checkbox.next('a').click(function () { + $(this).prev("input:checkbox").click(); }); + } + + // Add elements about selecting export type + exportMenu = $('
'); + cancelDiv = $('
').append($('