[Pkg-mozext-commits] [personasplus] 30/76: Restrict Specific Dimensions and File Types for header and footer when creating Cusom Personas

David Prévot taffit at moszumanska.debian.org
Fri Aug 4 21:45:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository personasplus.

commit 6dc8e3d419ee7cdacfbce59a53e9fd442fffc503
Author: Baris Derin <baris at barisderin.com>
Date:   Sun Aug 14 10:02:10 2016 +0300

    Restrict Specific Dimensions and File Types  for header and footer when creating Cusom Personas
    
    Restrict Specific Dimensions (3000 x 200) and File Types (png, jpg)
    for header and footer when creating Custom Personas.
    
          Restrict Specific Dimensions and File Types for header and footer when creating Custom Personas
    
     Restrict Specific Dimensions and File Types for header and footer when
    creating Custom Personas
---
 extension/content/customPersonaEditor.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/extension/content/customPersonaEditor.js b/extension/content/customPersonaEditor.js
index b915287..74a3447 100644
--- a/extension/content/customPersonaEditor.js
+++ b/extension/content/customPersonaEditor.js
@@ -213,12 +213,25 @@ var CustomPersonaEditor = {
     let property = control.id;
 
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
+    fp.appendFilter("Images", "*.png; *.jpg; *.jpeg");
     fp.init(window,
             this._strings.get("backgroundPickerDialogTitle"),
             Ci.nsIFilePicker.modeOpen);
     let result = fp.show();
 
     if (result == Ci.nsIFilePicker.returnOK) {
+      var img = new Image();
+      img.src = fp.fileURL.spec;
+      img.onload = function() {
+          if (img.naturalWidth !== 3000 || img.naturalHeight !== 200) {
+              var prompt = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+              if (prompt.confirm(null, "Personas Plus", "Image must be 3000 pixels wide and 200 pixels tall. This image does not meet required specifications.\n\nWould you like to read more about how to create your own background theme?")) {
+                  window.open("https://developer.mozilla.org/en-US/Add-ons/Themes/Background", '_blank');
+              }
+              return;
+          }
+      }
+
       // A random number is appended to avoid displaying a cached image
       // after the image has been modified.
       // See: https://bugzilla.mozilla.org/show_bug.cgi?id=543333

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/personasplus.git



More information about the Pkg-mozext-commits mailing list