From 7a1e9c789e164e4a5bef1c358f95d6882137252b Mon Sep 17 00:00:00 2001 From: "Xiaoyang Yu (Max)" Date: Fri, 20 Apr 2012 09:29:51 +0800 Subject: [PATCH 1/4] [Palette] Fix font in the svg of Header Widget This patch set the text font in jqm_header.svg and set to use OpenSans-SB in two other places --- src/css/builder.css | 1 + src/css/images/widgets/jqm_header.svg | Bin 2078 -> 2612 bytes 2 files changed, 1 insertion(+) diff --git a/src/css/builder.css b/src/css/builder.css index 7e30fc65..f088dfc0 100644 --- a/src/css/builder.css +++ b/src/css/builder.css @@ -39,6 +39,7 @@ body.ui-tabs.ui-widget { -webkit-border-bottom-left-radius: 0px; -webkit-border-bottom-right-radius: 0px; border: none; + font-family: OpenSans-SB; } /****************************************/ diff --git a/src/css/images/widgets/jqm_header.svg b/src/css/images/widgets/jqm_header.svg index 4ed2be01e956ef99a083e894394d5b2e54f7a808..05447365a1b5de6077c448b95ef8c312f0a965a9 100644 GIT binary patch delta 585 zcmah`!A`u?KDYS&Yo^2#2>?h$cj*I3%_) z=Wd|OH-eEQGgc_0g(j|Wfm^OtLO*(?)wc=HX<`hQ!d0R>ip#{$=_JVs-qZu%B)W#Q z=HiAdmxiiDmuURWBu8M%43g~;IXFfIedeA~%VcQ=MpTyhD&MT}Rzd&( delta 61 zcmdlYGEZQ`H>S-3th*Q|Z(tT Date: Wed, 20 Jun 2012 16:21:42 +0800 Subject: [PATCH 2/4] [FileIO] Export project as three options in export landing dialog --- src/css/builder.css | 81 ++++++++------- src/js/serialize.js | 248 ++++++++++++++++++++++++++++---------------- 2 files changed, 203 insertions(+), 126 deletions(-) diff --git a/src/css/builder.css b/src/css/builder.css index 68db9770..87aec7e5 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; @@ -1423,3 +1422,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.
' + + '' + ).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($('