Permalink
Browse files

rollback to 1.7 and update so buttons work

  • Loading branch information...
1 parent fd322e6 commit c48b8de3147fb03780cc622d850cab5ee41f3f1f Mike Buckley committed Mar 9, 2013
Showing with 3,818 additions and 15 deletions.
  1. 0 dist/pixelperfect-1.5.0.xpi
  2. 0 dist/pixelperfect-1.5.5.xpi
  3. 0 dist/pixelperfect-1.5.6.xpi
  4. 0 dist/pixelperfect-1.6.0.xpi
  5. 0 dist/pixelperfect-1.6.1.xpi
  6. 0 dist/pixelperfect-1.7.0.xpi
  7. 0 dist/pixelperfect-1.7.1.xpi
  8. BIN dist/pixelperfect-1.8.0.xpi
  9. +1 −0 not_used/dev_tools/pixelperfectplugin@openhouseconcepts.com
  10. BIN not_used/dist/pixelperfect-1.5.0.xpi
  11. BIN not_used/dist/pixelperfect-1.5.5.xpi
  12. BIN not_used/dist/pixelperfect-1.5.6.xpi
  13. BIN not_used/dist/pixelperfect-1.6.0.xpi
  14. BIN not_used/dist/pixelperfect-1.6.1.xpi
  15. BIN not_used/dist/pixelperfect-1.7.0.xpi
  16. BIN not_used/dist/pixelperfect-1.7.1.xpi
  17. BIN not_used/dist/pixelperfect-2.0.0.xpi
  18. BIN not_used/dist/pixelperfect-2.0.1.xpi
  19. +7 −0 not_used/packageExtension.sh
  20. +11 −0 not_used/pixel-perfect.sublime-project
  21. +7 −0 not_used/srcExtension/chrome.manifest
  22. +119 −0 not_used/srcExtension/chrome/content/browserscripts/dom-drag.js
  23. +87 −0 not_used/srcExtension/chrome/content/browserscripts/publicDocumentEvents.js
  24. +51 −0 not_used/srcExtension/chrome/content/main.js
  25. +4 −0 not_used/srcExtension/chrome/content/mainOverlay.js
  26. +4 −0 not_used/srcExtension/chrome/content/mainOverlay.xul
  27. +133 −0 not_used/srcExtension/chrome/content/pixelPerfectFileModule.js
  28. +141 −0 not_used/srcExtension/chrome/content/pixelPerfectModule.js
  29. +37 −0 not_used/srcExtension/chrome/content/pixelPerfectOverlay.xul
  30. +218 −0 not_used/srcExtension/chrome/content/pixelPerfectPanel.js
  31. +460 −0 not_used/srcExtension/chrome/content/pixelPerfectPanelActionsModule.js
  32. +198 −0 not_used/srcExtension/chrome/content/pixelPerfectUtilsModule.js
  33. +87 −0 not_used/srcExtension/chrome/content/ppLockAnimationModule.js
  34. +666 −0 not_used/srcExtension/chrome/content/slider.js
  35. 0 not_used/srcExtension/chrome/content/user_overlays/.leave
  36. +3 −0 not_used/srcExtension/chrome/locale/en-US/pixelperfect.dtd
  37. +3 −0 not_used/srcExtension/chrome/locale/en-US/pixelperfect.properties
  38. BIN not_used/srcExtension/chrome/skin/classic/images/bg-comp-loc.gif
  39. BIN not_used/srcExtension/chrome/skin/classic/images/bg-comp-small.jpg
  40. BIN not_used/srcExtension/chrome/skin/classic/images/bg-down-arrow.gif
  41. BIN not_used/srcExtension/chrome/skin/classic/images/bg-left-arrow.gif
  42. BIN not_used/srcExtension/chrome/skin/classic/images/bg-opacity-toggle-over.gif
  43. BIN not_used/srcExtension/chrome/skin/classic/images/bg-opacity-toggle.gif
  44. BIN not_used/srcExtension/chrome/skin/classic/images/bg-opacity.gif
  45. BIN not_used/srcExtension/chrome/skin/classic/images/bg-position-toggle-over.gif
  46. BIN not_used/srcExtension/chrome/skin/classic/images/bg-position-toggle.gif
  47. BIN not_used/srcExtension/chrome/skin/classic/images/bg-right-arrow.gif
  48. BIN not_used/srcExtension/chrome/skin/classic/images/bg-ul.gif
  49. BIN not_used/srcExtension/chrome/skin/classic/images/bg-up-arrow.gif
  50. BIN not_used/srcExtension/chrome/skin/classic/images/comp-small.jpg
  51. BIN not_used/srcExtension/chrome/skin/classic/images/logo-mini.jpg
  52. BIN not_used/srcExtension/chrome/skin/classic/images/logo_16x16.png
  53. BIN not_used/srcExtension/chrome/skin/classic/images/logo_32x32.png
  54. BIN not_used/srcExtension/chrome/skin/classic/images/position-controls-sprite.png
  55. BIN not_used/srcExtension/chrome/skin/classic/images/slider-1.png
  56. BIN not_used/srcExtension/chrome/skin/classic/images/slider-disabled-1.png
  57. BIN not_used/srcExtension/chrome/skin/classic/images/slider-disabled.png
  58. BIN not_used/srcExtension/chrome/skin/classic/images/slider.png
  59. BIN not_used/srcExtension/chrome/skin/classic/images/trash.gif
  60. +260 −0 not_used/srcExtension/chrome/skin/classic/pixelperfect.css
  61. +10 −0 not_used/srcExtension/defaults/preferences/prefs.js
  62. +20 −0 not_used/srcExtension/install.rdf
  63. +1 −1 packageExtension.sh
  64. +0 −3 pixel-perfect.sublime-project
  65. +5 −6 srcExtension/chrome.manifest
  66. +191 −0 srcExtension/chrome/pixelperfect/content/PixelPerfectPanel.js
  67. +13 −0 srcExtension/chrome/pixelperfect/content/browser.xul
  68. +129 −0 srcExtension/chrome/pixelperfect/content/browserscripts/dom-drag.js
  69. +87 −0 srcExtension/chrome/pixelperfect/content/browserscripts/publicDocumentEvents.js
  70. +138 −0 srcExtension/chrome/pixelperfect/content/fileUtils.js
  71. BIN srcExtension/chrome/pixelperfect/content/images/bg-comp-loc.gif
  72. BIN srcExtension/chrome/pixelperfect/content/images/bg-comp-small.jpg
  73. BIN srcExtension/chrome/pixelperfect/content/images/bg-down-arrow.gif
  74. BIN srcExtension/chrome/pixelperfect/content/images/bg-left-arrow.gif
  75. BIN srcExtension/chrome/pixelperfect/content/images/bg-opacity-toggle-over.gif
  76. BIN srcExtension/chrome/pixelperfect/content/images/bg-opacity-toggle.gif
  77. BIN srcExtension/chrome/pixelperfect/content/images/bg-opacity.gif
  78. BIN srcExtension/chrome/pixelperfect/content/images/bg-position-toggle-over.gif
  79. BIN srcExtension/chrome/pixelperfect/content/images/bg-position-toggle.gif
  80. BIN srcExtension/chrome/pixelperfect/content/images/bg-right-arrow.gif
  81. BIN srcExtension/chrome/pixelperfect/content/images/bg-ul.gif
  82. BIN srcExtension/chrome/pixelperfect/content/images/bg-up-arrow.gif
  83. BIN srcExtension/chrome/pixelperfect/content/images/comp-small.jpg
  84. BIN srcExtension/chrome/pixelperfect/content/images/eye-off.gif
  85. BIN srcExtension/chrome/pixelperfect/content/images/eye-on.gif
  86. BIN srcExtension/chrome/pixelperfect/content/images/logo-mini.jpg
  87. BIN srcExtension/chrome/pixelperfect/content/images/logo_16x16.png
  88. BIN srcExtension/chrome/pixelperfect/content/images/logo_32x32.png
  89. BIN srcExtension/chrome/pixelperfect/content/images/trash.gif
  90. +46 −0 srcExtension/chrome/pixelperfect/content/panel.html
  91. +405 −0 srcExtension/chrome/pixelperfect/content/panelActions.js
  92. +34 −0 srcExtension/chrome/pixelperfect/content/pixelPerfectOverlay.xul
  93. +47 −0 srcExtension/chrome/pixelperfect/content/pixelperfect.css
  94. 0 srcExtension/chrome/pixelperfect/content/user_overlays/.leave
  95. +188 −0 srcExtension/chrome/pixelperfect/content/utils.js
  96. +3 −0 srcExtension/chrome/pixelperfect/locale/en-US/pixelperfect.dtd
  97. +1 −0 srcExtension/chrome/pixelperfect/locale/en-US/pixelperfect.properties
  98. +0 −2 srcExtension/defaults/preferences/prefs.js
  99. +3 −3 srcExtension/install.rdf
View
0 dist/pixelperfect-1.5.0.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.5.5.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.5.6.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.6.0.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.6.1.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.7.0.xpi 100644 → 100755
File mode changed.
View
0 dist/pixelperfect-1.7.1.xpi 100644 → 100755
File mode changed.
View
BIN dist/pixelperfect-1.8.0.xpi
Binary file not shown.
View
1 not_used/dev_tools/pixelperfectplugin@openhouseconcepts.com
@@ -0,0 +1 @@
+C:\workspace\ohc\PixelPerfect\srcExtension\
View
BIN not_used/dist/pixelperfect-1.5.0.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.5.5.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.5.6.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.6.0.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.6.1.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.7.0.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-1.7.1.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-2.0.0.xpi
Binary file not shown.
View
BIN not_used/dist/pixelperfect-2.0.1.xpi
Binary file not shown.
View
7 not_used/packageExtension.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+# generate the XPI file
+# TODO: Pass in version as parameter
+VERSION=2.0.1
+echo "Generating $APP_NAME.xpi..."
+cd srcExtension
+zip -r ../dist/pixelperfect-$VERSION.xpi *
View
11 not_used/pixel-perfect.sublime-project
@@ -0,0 +1,11 @@
+{
+ "folders":
+ [
+ {
+ "path": "/Users/mbuckley/projects/ohc/PixelPerfect"
+ },
+ {
+ "path": "/Users/mbuckley/projects/ohc/InvertColor"
+ }
+ ]
+}
View
7 not_used/srcExtension/chrome.manifest
@@ -0,0 +1,7 @@
+content pixelperfect chrome/content/
+skin pixelperfect classic/1.0 chrome/skin/classic/
+locale pixelperfect en-US chrome/locale/en-US/
+
+resource pixelperfect chrome/
+
+overlay chrome://firebug/content/firebugOverlay.xul chrome://pixelperfect/content/mainOverlay.xul
View
119 not_used/srcExtension/chrome/content/browserscripts/dom-drag.js
@@ -0,0 +1,119 @@
+var Drag = {
+
+ obj : null,
+ disabled : false,
+
+ init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
+ {
+ o.onmousedown = Drag.start;
+
+ o.hmode = bSwapHorzRef ? false : true ;
+ o.vmode = bSwapVertRef ? false : true ;
+
+ o.root = oRoot && oRoot != null ? oRoot : o ;
+
+ if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
+ if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
+ if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
+ if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
+
+ o.minX = typeof minX != 'undefined' ? minX : null;
+ o.minY = typeof minY != 'undefined' ? minY : null;
+ o.maxX = typeof maxX != 'undefined' ? maxX : null;
+ o.maxY = typeof maxY != 'undefined' ? maxY : null;
+
+ o.xMapper = fXMapper ? fXMapper : null;
+ o.yMapper = fYMapper ? fYMapper : null;
+
+ o.root.onDragStart = new Function();
+ o.root.onDragEnd = new Function();
+ o.root.onDrag = new Function();
+ },
+
+ start : function(e)
+ {
+ if(!Drag.disabled) {
+ var o = Drag.obj = this;
+ e = Drag.fixE(e);
+ var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
+ var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
+ o.root.onDragStart(x, y);
+
+ o.lastMouseX = e.clientX;
+ o.lastMouseY = e.clientY;
+
+ if (o.hmode) {
+ if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
+ if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
+ } else {
+ if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
+ if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
+ }
+
+ if (o.vmode) {
+ if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
+ if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
+ } else {
+ if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
+ if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
+ }
+
+ document.onmousemove = Drag.drag;
+ document.onmouseup = Drag.end;
+ }
+
+ return false;
+ },
+
+ drag : function(e)
+ {
+ if(!Drag.disabled) {
+ e = Drag.fixE(e);
+ var o = Drag.obj;
+
+ var ey = e.clientY;
+ var ex = e.clientX;
+ var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
+ var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
+ var nx, ny;
+
+ if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
+ if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
+ if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
+ if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
+
+ nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
+ ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
+
+ if (o.xMapper) nx = o.xMapper(y)
+ else if (o.yMapper) ny = o.yMapper(x)
+
+ Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
+ Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
+ Drag.obj.lastMouseX = ex;
+ Drag.obj.lastMouseY = ey;
+
+ Drag.obj.root.onDrag(nx, ny);
+ }
+ return false;
+ },
+
+ end : function()
+ {
+ if(!Drag.disabled) {
+ document.onmousemove = null;
+ document.onmouseup = null;
+ Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
+ parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
+ Drag.obj = null;
+ }
+ },
+
+ fixE : function(e)
+ {
+ if (typeof e == 'undefined') e = window.event;
+ if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
+ if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
+ return e;
+ }
+};
View
87 not_used/srcExtension/chrome/content/browserscripts/publicDocumentEvents.js
@@ -0,0 +1,87 @@
+var pixelPerfect = pixelPerfect || {};
+
+if (typeof pixelPerfect.publicDocument == "undefined") {
+ pixelPerfect.publicDocument = {};
+}
+
+pixelPerfect.publicDocument = function () {
+ // private
+ var overlayDivId = 'pp_overlay';
+
+ // public
+ return {
+ notifyPanelOverlayPositionHasChanged: function(overlayLocked) {
+ if ("createEvent" in document) {
+ var element = document.getElementById("ppoc");
+ if (element == null) {
+ var element = document.createElement("PixelPerfectOverlayCoordinates");
+ }
+ element.setAttribute("id", "ppoc")
+ element.setAttribute("xPos", this.findPixelPerfectXPos());
+ element.setAttribute("yPos", this.findPixelPerfectYPos());
+ document.documentElement.appendChild(element);
+
+ var evt = document.createEvent("Events");
+ evt.initEvent("overlayMovementEvent", true, false);
+ element.dispatchEvent(evt);
+ }
+ },
+ notifyToSaveLastPosition: function(overlayLocked) {
+ if ("createEvent" in document) {
+ var element = document.getElementById("ppoc");
+ if (element == null) {
+ var element = document.createElement("PixelPerfectOverlayCoordinates");
+ }
+ element.setAttribute("id", "ppoc")
+ element.setAttribute("xPos", this.findPixelPerfectXPos());
+ element.setAttribute("yPos", this.findPixelPerfectYPos());
+ document.documentElement.appendChild(element);
+
+ var evt = document.createEvent("Events");
+ evt.initEvent("saveLastPositionEvent", true, false);
+ element.dispatchEvent(evt);
+ }
+ },
+
+ findPixelPerfectXPos: function() {
+ return this.findPixelPerfectPos()[0];
+ },
+
+ findPixelPerfectYPos: function() {
+ return this.findPixelPerfectPos()[1];
+ },
+
+ findPixelPerfectPos: function() {
+ return this.findPos(window.content.document.getElementById(overlayDivId));
+ },
+
+ findPos: function(obj) {
+ var curleft = curtop = 0;
+ if (obj.offsetParent) {
+ do {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ }
+ while (obj = obj.offsetParent);
+ }
+ return [curleft, curtop];
+ },
+
+ reloadLastOverlay: function() {
+ if ("createEvent" in document) {
+ var element = document.getElementById("ppReloadLastOverlay");
+ if (element == null) {
+ var element = document.createElement("PixelPerfectLastOverlay");
+ }
+ element.setAttribute("id", "ppReloadLastOverlay")
+ document.documentElement.appendChild(element);
+
+ var evt = document.createEvent("Events");
+ evt.initEvent("reloadLastOverlayEvent", true, false);
+ element.dispatchEvent(evt);
+ }
+ }
+ };
+}();
+
+window.addEventListener("load", pixelPerfect.publicDocument.reloadLastOverlay, false);
View
51 not_used/srcExtension/chrome/content/main.js
@@ -0,0 +1,51 @@
+define([
+ "firebug/lib/trace",
+ "firebug/trace/traceModule",
+ "firebug/trace/traceListener",
+ "pixelperfect/pixelPerfectPanel",
+ "pixelperfect/pixelPerfectModule",
+],
+function(FBTrace, TraceModule, TraceListener) {
+
+ // ********************************************************************************************* //
+ // The application/extension object
+
+ var theApp =
+ {
+ initialize: function()
+ {
+
+ this.traceListener = new TraceListener("pixelPerfect;", "DBG_PIXELPERFECT", true, "resource://pixelperfect/skin/pixelperfect.css");
+ TraceModule.addListener(this.traceListener);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfect extension initialize");
+
+ // load scripts into main browser overlay (drag plugin, events, etc)
+ Firebug.PixelPerfectUtilsModule.loadRequiredJsIntoToMainBrowserOverlay();
+ },
+
+ shutdown: function()
+ {
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfect extension shutdown");
+
+ // Unregister all registered Firebug components
+ Firebug.unregisterPanel(Firebug.PixelPerfectPanel);
+ Firebug.unregisterModule(Firebug.PixelPerfectModule);
+ Firebug.unregisterModule(Firebug.PixelPerfectFileModule);
+ Firebug.unregisterModule(Firebug.PixelPerfectPanelActionsModule);
+ Firebug.unregisterModule(Firebug.PixelPerfectUtilsModule);
+ Firebug.unregisterStylesheet("chrome://pixelperfect/skin/pixelperfect.css");
+ Firebug.unregisterStringBundle("chrome://pixelperfect/locale/pixelperfect.properties");
+
+ // TODO: Extension shutdown
+ }
+ }
+
+ // ********************************************************************************************* //
+
+return theApp;
+
+// ********************************************************************************************* //
+});
View
4 not_used/srcExtension/chrome/content/mainOverlay.js
@@ -0,0 +1,4 @@
+// ********************************************************************************************* //
+var config = {id: "pixelperfectplugin@openhouseconcepts.com"};
+Firebug.registerExtension("pixelperfect", config);
+// ********************************************************************************************* //
View
4 not_used/srcExtension/chrome/content/mainOverlay.xul
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/mainOverlay.js"/>
+</overlay>
View
133 not_used/srcExtension/chrome/content/pixelPerfectFileModule.js
@@ -0,0 +1,133 @@
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+],
+function(Obj, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.PixelPerfectFileModule = Obj.extend(Firebug.Module,
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectFileModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectFileModule.shutdown");
+ },
+
+ getFirefoxProfileRootFolder: function() {
+ // get the nsIFile obj => user's home (profile) directory
+ const DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1", "nsIProperties");
+ var nsIFileObj;
+ try {
+ nsIFileObj = (new DIR_SERVICE()).get("ProfD", Components.interfaces.nsIFile);
+ }
+ catch (e) {
+ alert("error");
+ }
+ return nsIFileObj;
+ },
+
+ chooseFile: function() {
+ var nsIFilePicker = Components.interfaces.nsIFilePicker;
+ var fp = Components.classes["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
+ fp.appendFilters(nsIFilePicker.filterImages);
+ fp.init(window, "Select a File", nsIFilePicker.modeOpen);
+
+ var res = fp.show();
+ var filePath = '';
+
+ if (res == nsIFilePicker.returnOK){
+ var sourceFile = fp.file;
+ }
+ return sourceFile;
+ },
+
+ copyFile: function(sourcefile) {
+ // get a component for the file to copy
+ var aFile = Components.classes["@mozilla.org/file/local;1"]
+ .createInstance(Components.interfaces.nsILocalFile);
+ if (!aFile) return false;
+
+ // get a component for the directory to copy to
+ var aDir = Components.classes["@mozilla.org/file/local;1"]
+ .createInstance(Components.interfaces.nsILocalFile);
+ if (!aDir) return false;
+
+ // next, assign URLs to the file components
+ var userOverlayPathStr = this.getUserOverlayPath().path;
+ aFile.initWithPath(sourcefile.path);
+ aDir.initWithPath(userOverlayPathStr);
+
+ // finally, copy the file, without renaming it
+ try {
+ aFile.copyTo(aDir,null);
+ } catch(ex) {
+ // file already exists.
+ // add error logging lib here
+ }
+ return aFile.leafName;
+ },
+
+ getCurrentOverlayFiles: function() {
+ // get a component for the file to copy
+ var file = Components.classes["@mozilla.org/file/local;1"]
+ .createInstance(Components.interfaces.nsILocalFile);
+ if (!file) return false;
+
+ var userOverlayPathStr = this.getUserOverlayPath().path;
+ file.initWithPath(userOverlayPathStr);
+
+ // file is the given directory (nsIFile)
+ var entries = file.directoryEntries;
+ var overlayArr = [];
+ while(entries.hasMoreElements())
+ {
+ var entry = entries.getNext();
+ entry.QueryInterface(Components.interfaces.nsIFile);
+ if(entry.isFile()) {
+ var filePath = entry.path;
+ var fileName = filePath.replace(userOverlayPathStr, '').substring(1);
+ if(fileName !== ".leave") {
+ overlayArr.push(fileName);
+ }
+ }
+ }
+ return overlayArr;
+ },
+
+ //TODO: update extension folder name from config settings
+ getUserOverlayPath: function() {
+ var userOverlayPath = this.getFirefoxProfileRootFolder().clone();
+ userOverlayPath.append('extensions');
+ userOverlayPath.append('pixelperfectplugin@openhouseconcepts.com');
+ userOverlayPath.append('chrome');
+ userOverlayPath.append('content');
+ userOverlayPath.append('user_overlays');
+ return userOverlayPath;
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.PixelPerfectFileModule);
+
+return Firebug.PixelPerfectFileModule;
+
+// ********************************************************************************************* //
+});
View
141 not_used/srcExtension/chrome/content/pixelPerfectModule.js
@@ -0,0 +1,141 @@
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+ "pixelperfect/pixelPerfectFileModule",
+ "pixelperfect/pixelPerfectUtilsModule",
+ "pixelperfect/pixelPerfectPanel"
+],
+function(Obj, FBTrace) {
+
+ // ********************************************************************************************* //
+ // Custom Module Implementation
+
+ Firebug.PixelPerfectModule = Obj.extend(Firebug.Module,
+ {
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectModule.initialize");
+
+ this.initPrefs();
+ this.addEventListeners();
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectModule.shutdown");
+ },
+
+ initPrefs: function() {
+ // Read persistent options and set them in our pixelPerfect object.
+ pixelPerfect.prefs = {};
+ },
+
+ addEventListeners: function() {
+ document.addEventListener("overlayMovementEvent", function(evt) { Firebug.PixelPerfectModule.overlayMovementListener(evt);}, false, true);
+ document.addEventListener("saveLastPositionEvent", function(evt) { Firebug.PixelPerfectModule.saveLastPositionListener(evt);}, false, true);
+ document.addEventListener("reloadLastOverlayEvent", function(evt) { Firebug.PixelPerfectModule.reloadLastOverlayListener(evt);}, false, true);
+ },
+
+ overlayMovementListener: function(evt) {
+ },
+
+ saveLastPositionListener: function(evt) {
+ //this.saveLastPosition(evt.target.getAttribute("xPos"), evt.target.getAttribute("yPos"),Firebug.currentContext.getPanel("pixelPerfect").document.getElementById("ctl-opacity-numbers").innerHTML);
+ },
+
+ reloadLastOverlayListener: function(evt) {
+ Firebug.PixelPerfectUtilsModule.fireEyeClickEvent("eye_" + Firebug.getPref(Firebug.prefDomain, "pixelPerfect.lastOverlayFileName"), Firebug.currentContext.getPanel("pixelperfect").document);
+ },
+
+ //@deprecated
+ updateAbsolutePositionControls: function(xPos, yPos) {
+ var xPosNumber = Firebug.currentContext.getPanel("pixelPerfect").document.getElementById("ctl-left-position");
+ xPosNumber.innerHTML = xPos;
+
+ var yPosNumber = Firebug.currentContext.getPanel("pixelPerfect").document.getElementById("ctl-top-position");
+ yPosNumber.innerHTML = yPos;
+ },
+
+ saveLastPosition: function(xPos, yPos, opacity) {
+ Firebug.PixelPerfectModule.saveLastPosition(xPos, yPos, opacity);
+ },
+
+ // When an option changes, this is called.
+ updateOption: function(name, value) {
+ if ("pixelPerfect.hidestatusbar" == name) {
+ Firebug.PixelPerfectUtilsModule.toggleStatusBar(value);
+ }
+ },
+
+ shutdown: function()
+ {
+ if (Firebug.getPref('defaultPanelName') == 'pixelPerfect') {
+ Firebug.setPref('defaultPanelName', 'console');
+ }
+ },
+
+ showPanel: function(browser, panel)
+ {
+ var isPixelPerfectExtension = panel && panel.name == "pixelPerfect";
+ var PixelPerfectExtensionButtons = browser.chrome.$("fbPixelPerfectPanelButtons");
+ if (Firebug.getPref(Firebug.prefDomain, "pixelPerfect.hidewhenfocuslost")) {
+ Firebug.PixelPerfectUtilsModule.setVisibilityForOverlay(isPixelPerfectExtension);
+ }
+ collapse(PixelPerfectExtensionButtons, !isPixelPerfectExtension);
+ },
+
+ addOverlay: function(pixelPerfectPanel)
+ {
+ var sourceFile = Firebug.PixelPerfectFileModule.chooseFile();
+
+ var fileName = Firebug.PixelPerfectFileModule.copyFile(sourceFile);
+ var newOverlayData = Firebug.PixelPerfectUtilsModule.getOverlayElementLiteral(fileName);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelperfect; PixelPerfectModule.addOverlay");
+
+ pixelPerfectPanel.PPTemplate.addOverlay(newOverlayData);
+ },
+
+ saveLastPosition: function(xPos, yPos, opacity) {
+ Firebug.setPref(Firebug.prefDomain, "pixelPerfect.lastXPos", xPos);
+ Firebug.setPref(Firebug.prefDomain, "pixelPerfect.lastYPos", yPos);
+ Firebug.setPref(Firebug.prefDomain, "pixelPerfect.opacity", opacity);
+ },
+
+ pixelPerfectHelp: function(menuitem) {
+ // Add tab, then make active
+ if ("Pixel Perfect Home" == menuitem.label) {
+ gBrowser.selectedTab = gBrowser.addTab("http://pixelperfectplugin.com/");
+ }
+ else if ("File an issue" == menuitem.label) {
+ gBrowser.selectedTab = gBrowser.addTab("https://github.com/openhouseconcept/PixelPerfect/issues");
+ }
+ else if ("Send Feedback" == menuitem.label) {
+ gBrowser.selectedTab = gBrowser.addTab("http://pixelperfectplugin.com/");
+ }
+ }
+
+ });
+
+ // ********************************************************************************************* //
+ // Registration
+
+ Firebug.registerModule(Firebug.PixelPerfectModule);
+
+ return Firebug.PixelPerfectModule;
+
+ // ********************************************************************************************* //
+});
View
37 not_used/srcExtension/chrome/content/pixelPerfectOverlay.xul
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!DOCTYPE window SYSTEM "chrome://pixelperfect/locale/pixelperfect.dtd">
+<?xml-stylesheet href="chrome://pixelperfect/content/pixelperfect.css"?>
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="strings_pixelperfect" src="chrome://pixelperfect/locale/pixelperfect.properties"/>
+ </stringbundleset>
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/utils.js"/>
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/panelActions.js"/>
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/fileUtils.js"/>
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/PixelPerfectPanelNew.js"></script>
+ <script type="application/x-javascript" src="chrome://pixelperfect/content/slider.js"></script>
+
+
+ <commandset id="mainCommandSet">
+ <command id="cmd_addOverlay" oncommand="Firebug.PixelPerfectModule.addOverlay();" />
+ </commandset>
+
+ <toolbar id="fbToolbar" align="center">
+ <hbox id="fbToolbarInner" insertbefore="fbDetachButton" flex="1" align="center">
+ <hbox id="fbPixelPerfectPanelButtons" insertafter="fbNetButtons">
+ <toolbarbutton label="&pixelperfect.toolbarbutton.addoverlay.label;" class="toolbar-text-button"
+ tooltiptext="&pixelperfect.toolbarbutton.addoverlay.hover;" command="cmd_addOverlay"/>
+ <toolbarbutton label="Help" id="pixelPerfectHelpMenu" type="menu" class="toolbar-text-button">
+ <menupopup>
+ <menuitem label="Pixel Perfect Home" oncommand="Firebug.PixelPerfectModule.pixelPerfectHelp(this);" />
+ <menuseparator/>
+ <menuitem label="File an issue" oncommand="Firebug.PixelPerfectModule.pixelPerfectHelp(this);" />
+ <menuseparator/>
+ <menuitem label="Send Feedback" oncommand="Firebug.PixelPerfectModule.pixelPerfectHelp(this);" />
+ </menupopup>
+ </toolbarbutton>
+ </hbox>
+
+ </hbox>
+ </toolbar>
+</overlay>
View
218 not_used/srcExtension/chrome/content/pixelPerfectPanel.js
@@ -0,0 +1,218 @@
+define([
+ "firebug/lib/object",
+ "firebug/lib/trace",
+ "firebug/lib/locale",
+ "firebug/lib/domplate",
+ "pixelperfect/slider",
+ "pixelperfect/pixelPerfectModule",
+ "pixelperfect/pixelPerfectPanelActionsModule",
+ "pixelperfect/pixelPerfectUtilsModule"
+],
+function(Obj, FBTrace, Locale, Domplate, PixelPerfectModule) {
+
+ // ********************************************************************************************* //
+ // Custom Panel Implementation
+
+ var panelName = "pixelperfect";
+
+ Firebug.PixelPerfectPanel = function PixelPerfectPanel() {};
+ Firebug.PixelPerfectPanel.prototype = Obj.extend(Firebug.Panel,
+ {
+ name: panelName,
+ title: "Pixel Perfect",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function()
+ {
+ Firebug.Panel.initialize.apply(this, arguments);
+
+ // Firebug.PixelPerfectUtilsModule.loadRequiredJsIntoToMainBrowserOverlay();
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanel.initialize");
+
+ // TODO: Panel initialization (there is one panel instance per browser tab)
+
+ this.refresh();
+ },
+
+ destroy: function(state)
+ {
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanel.destroy");
+
+ Firebug.Panel.destroy.apply(this, arguments);
+ },
+
+ show: function(state)
+ {
+ Firebug.Panel.show.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanel.show");
+ },
+
+ refresh: function()
+ {
+ this.PPTemplate.render(this.panelNode);
+
+ // refresh fd slider plugin
+ var ppPanel = Firebug.currentContext.getPanel(panelName);
+ fdSliderController.onload();
+ fdSliderController.construct(null, ppPanel.document);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ /**
+ * Extends toolbar for this panel.
+ */
+ getPanelToolbarButtons: function()
+ {
+ var buttons = [];
+
+ buttons.push({
+ label: "pixelperfect.add.label",
+ tooltiptext: "pixelperfect.add.tooltip",
+ command: FBL.bindFixed(this.onAddOverlay, this)
+ });
+
+ return buttons;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Commands
+
+ onAddOverlay: function()
+ {
+
+ Firebug.PixelPerfectModule.addOverlay(this);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelperfect; PixelPerfectPanel.onAddOverlay");
+ }
+ });
+
+ // ********************************************************************************************* //
+ // Panel UI (Domplate)
+
+ // Register locales before the following template definition.
+ Firebug.registerStringBundle("chrome://pixelperfect/locale/pixelperfect.properties");
+
+ /**
+ * Domplate template used to render panel's content. Note that the template uses
+ * localized strings and so, Firebug.registerStringBundle for the appropriate
+ * locale file must be already executed at this moment.
+ */
+ with (Domplate) {
+ Firebug.PixelPerfectPanel.prototype.PPTemplate = domplate(
+ {
+ panelTag:
+ DIV({class: "container_4"},
+ DIV({id: "overlay-container", class: "grid_2"},
+ DIV({id: "overlay-scroll"},
+ UL({id: "overlay-list"},
+ FOR("item", "overlayEyeElements",
+ TAG("$overlayTag", {item: "$item"})
+ )
+ )
+ )
+ ),
+ DIV({id: "options", class: "grid_1"},
+ H3("Opacity"),
+ DIV({id: "opacity-toggle"},
+ INPUT({name: "opacity-slider", id: "opacity-slider", type: "text", title: "Range: 10 - 100", class: "fd_range_10_100 fd_hide_input fd_callback_Firebug.PixelPerfectPanelActionsModule.opacitySliderUpdate", value:"50"})
+ ),
+ DIV({id: "position-controls"},
+ DIV({class: "btn-lock", onclick: "$togglePositionLock"})
+ /*DIV({class: "bt-left", onclick: "$leftArrowMove"}),
+ DIV({class: "bt-right", onclick: "$rightArrowMove"}),
+ DIV({class: "bt-up", onclick: "$topArrowMove"}),
+ DIV({class: "bt-down", onclick: "$bottomArrowMove"})*/
+ ),
+ DIV({id: "position-lock"},
+ INPUT({id: "position-lock-chk", name: "position-lock", type: "checkbox", onclick: "$togglePositionLock"}),
+ H3("Lock?")
+ )
+ )
+ ),
+ overlayTag:
+ LI({_myprop: "$item", class: "li_$item.id"},
+ IMG({width: "31", height: "23", src: "$item.thumbPath", id: "eye_$item.id", dataId: "$item.file", onclick: "$toggleOverlay"})
+ ),
+ leftArrowMove: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.leftArrowMove();
+ },
+ rightArrowMove: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.rightArrowMove();
+ },
+ topArrowMove: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.topArrowMove();
+ },
+ bottomArrowMove: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.bottomArrowMove();
+ },
+ togglePositionLock: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.togglePositionLock(event.target);
+ },
+ updateZIndex: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.updateZIndex();
+ },
+ toggleOverlay: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.toggleOverlay(event.target.id, event.target.getAttribute("dataId"));
+ },
+ deleteOverlay: function(event)
+ {
+ Firebug.PixelPerfectPanelActionsModule.deleteOverlay(event.target.getAttribute("dataParentId"),event.target.getAttribute("dataEyeId"),event.target.getAttribute("dataFileName"));
+ },
+
+ render: function(parentNode)
+ {
+ var overlayEyeElements = Firebug.PixelPerfectUtilsModule.buildEyeElementData(Firebug.currentContext.getPanel(panelName));
+
+ var args = {
+ overlayEyeElements: overlayEyeElements
+ };
+
+ this.panelTag.replace(args, parentNode, this);
+ },
+
+ addOverlay: function(overlayData) {
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelperfect; PixelPerfectPanel.PPTemplate.addOverlay");
+
+ var args = {
+ item: overlayData
+ };
+ var ppPanel = Firebug.currentContext.getPanel(panelName);
+
+ var existingOverlayElement = ppPanel.document.getElementById("li_" + overlayData.id);
+ if(existingOverlayElement == null) {
+ this.overlayTag.append(args, ppPanel.document.getElementById("overlay-list"), this);
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanel.addOverlay. Added new overlay to grid");
+ }
+ }
+ })}
+
+ // ********************************************************************************************* //
+ // Registration
+
+ Firebug.registerPanel(Firebug.PixelPerfectPanel);
+ Firebug.registerStylesheet("chrome://pixelperfect/skin/pixelperfect.css");
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanel.js, stylesheet registered");
+
+ return Firebug.PixelPerfectPanel;
+
+// ********************************************************************************************* //
+});
View
460 not_used/srcExtension/chrome/content/pixelPerfectPanelActionsModule.js
@@ -0,0 +1,460 @@
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+ "pixelperfect/pixelPerfectUtilsModule",
+ "pixelperfect/ppLockAnimationModule"
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+var overlayLocked = false;
+
+Firebug.PixelPerfectPanelActionsModule = FBL.extend(Firebug.Module,
+{
+ // private
+
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelperfect; PixelPerfectPanelActionsModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelperfect; PixelPerfectPanelActionsModule.shutdown");
+ },
+
+ getDocuments: function() {
+ var documents = undefined;
+ if(documents === undefined) {
+ mainDocument = window.content.document;
+
+ var ppPanel = Firebug.currentContext.getPanel("pixelperfect");
+ panelDocument = ppPanel.document;
+ documents = {main: mainDocument, panel: panelDocument};
+ }
+ return documents;
+ },
+
+ getPrefValue: function(name){
+
+ const PrefService = Components.classes["@mozilla.org/preferences-service;1"];
+ const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+ const nsIPrefBranch2 = Components.interfaces.nsIPrefBranch2;
+ const prefs = PrefService.getService(nsIPrefBranch2);
+ const prefDomain = "extensions.firebug";
+
+ //Check if this is global firefox preference.
+ var prefName;
+ if (name.indexOf("browser.") != -1) {
+ prefName = name;
+ } else {
+ prefName = prefDomain + "." + name;
+ }
+
+ var type = prefs.getPrefType(prefName);
+
+ if (type == nsIPrefBranch.PREF_STRING) {
+ return prefs.getCharPref(prefName);
+ }
+ else {
+ if (type == nsIPrefBranch.PREF_INT) {
+ return prefs.getIntPref(prefName);
+ }
+ else {
+ if (type == nsIPrefBranch.PREF_BOOL) {
+ return prefs.getBoolPref(prefName);
+ }
+ }
+ }
+ },
+
+ setPrefValue: function(name, value){
+ const PrefService = Components.classes["@mozilla.org/preferences-service;1"];
+ const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+ const nsIPrefBranch2 = Components.interfaces.nsIPrefBranch2;
+ const prefs = PrefService.getService(nsIPrefBranch2);
+ const prefDomain = "extensions.firebug";
+
+ //Check if this is global firefox preference.
+ var prefName;
+ if (name.indexOf("browser.") != -1) {
+ prefName = name;
+ } else {
+ prefName = prefDomain + "." + name;
+ }
+
+ var type = prefs.getPrefType(prefName);
+ if (type == nsIPrefBranch.PREF_STRING) {
+ prefs.setCharPref(prefName, value);
+ }
+ else {
+ if (type == nsIPrefBranch.PREF_INT) {
+ prefs.setIntPref(prefName, value);
+ }
+ else {
+ if (type == nsIPrefBranch.PREF_BOOL) {
+ prefs.setBoolPref(prefName, value);
+ }
+ else {
+ if (type == nsIPrefBranch.PREF_INVALID) {
+ throw "Invalid preference: " + prefName;
+ }
+ }
+ }
+ }
+ },
+
+ // Wrapper for getting preferences with a default.
+ // Returns undefined if the preference doesn't exist and no default is specified.
+ getPref: function(name, defaultval){
+ var val = this.getPrefValue(name);
+ return ("undefined" == typeof(val) ? defaultval : val);
+ },
+
+ toggleOverlay: function(overlayIconDocumentId, overlayUrl) {
+ try {
+ var mainDocument = this.getDocuments().main,
+ panelDocument = this.getDocuments().panel,
+ pixelperfect = mainDocument.getElementById('pp_overlay'),
+ overlayIconEle = panelDocument.getElementById(overlayIconDocumentId),
+ pageBody = mainDocument.getElementsByTagName("body")[0],
+ overlayUrlNoSpaces = overlayUrl.replace(/\s/g, "%20"),
+ chromeToOverlayUrl = 'chrome://pixelperfect/content/user_overlays/' + overlayUrl,
+ chromeToOverlayUrlNoSpaces = 'chrome://pixelperfect/content/user_overlays/' + overlayUrlNoSpaces;
+
+
+ if (pixelperfect == null) {
+ this.turnOnOverlay(chromeToOverlayUrl, chromeToOverlayUrlNoSpaces, pageBody, overlayUrl);
+ overlayIconEle.setAttribute("class", "overlay-active");
+ }
+ else {
+ // hide overlay
+ this.setPrefValue("pixelPerfect.lastXPos", this.findPixelPerfectXPos('pp_overlay'));
+ this.setPrefValue("pixelPerfect.lastYPos", this.findPixelPerfectYPos('pp_overlay'));
+ pageBody.removeChild(pixelperfect);
+ this.setPrefValue("pixelPerfect.lastOverlayFileName", '');
+
+ var currentOverlayBackgroundUrl = pixelperfect.style.background;
+
+
+ // user has clicked on a different overlay
+ if (currentOverlayBackgroundUrl.indexOf(overlayUrlNoSpaces) == -1) {
+ this.setPrefValue("pixelPerfect.lastXPos", '0');
+ this.setPrefValue("pixelPerfect.lastYPos", '0');
+ this.setPrefValue("pixelPerfect.opacity", '0.5');
+ this.setPrefValue("pixelPerfect.zIndex", '1000');
+ this.setPrefValue("pixelPerfect.overlayLocked", false);
+
+ this.resetOverlayIconsActiveState();
+ overlayIconEle.setAttribute("class", "overlay-active");
+
+ // turn on new overlay
+ this.turnOnOverlay(chromeToOverlayUrl, chromeToOverlayUrlNoSpaces, pageBody, overlayUrl);
+ }
+
+ else {
+ overlayIconEle.setAttribute("class", "");
+ }
+ }
+ } catch(err) {
+ Firebug.Console.log("exception => " + err);
+ }
+ },
+
+ resetOverlayIconsActiveState: function() {
+ var overlayList = this.getDocuments().panel.getElementById('overlay-list'),
+ overlayIcons = overlayList.getElementsByTagName("img");
+
+ for(var i = 0, overlayIcon; overlayIcon = overlayIcons[i]; i++) {
+ overlayIcon.setAttribute("class", "");
+ }
+ },
+
+ turnOnOverlay: function(chromeToOverlayUrl, chromeToOverlayUrlNoSpaces, pageBody, overlayUrl){
+
+ var mainDocument = this.getDocuments().main,
+ panelDocument = this.getDocuments().panel;
+ var divPixelPerfect = mainDocument.createElement("div");
+ divPixelPerfect.setAttribute("id", 'pp_overlay');
+
+ // updateZIndex from pref
+ // var zIndexTextInputEle = panelDocument.getElementById('z-index-input');
+ // var savedZIndex = this.getPref("pixelPerfect.zIndex");
+ // zIndexTextInputEle.value = savedZIndex;
+
+ imageDimensions = this.getImageDimensions(chromeToOverlayUrl);
+ var width = imageDimensions[0];
+ var height = imageDimensions[1];
+ divPixelPerfect.setAttribute("style", "z-index: 10000");
+ divPixelPerfect.style.background = 'url(' + chromeToOverlayUrlNoSpaces + ') no-repeat';
+ divPixelPerfect.style.width = width;
+ divPixelPerfect.style.height = height;
+
+ divPixelPerfect.style.opacity = 0.5;
+ divPixelPerfect.style.MozOpacity = 0.5;
+ divPixelPerfect.style.position = 'absolute';
+ divPixelPerfect.style.top = this.getPref("pixelPerfect.lastYPos") + 'px';
+ divPixelPerfect.style.left = this.getPref("pixelPerfect.lastXPos") + 'px';
+ divPixelPerfect.style.cursor = 'all-scroll';
+
+ var draggableScriptId = "draggable-script";
+
+ var existingDraggableScript = mainDocument.getElementById(draggableScriptId);
+ this.removeChildElement(existingDraggableScript, pageBody);
+ pageBody.appendChild(divPixelPerfect);
+
+ // update overlayLocked Attribute from pref
+ var overlayLockedChkEle = panelDocument.getElementById('position-lock-chk');
+ overlayLocked = this.getPref("pixelPerfect.overlayLocked");
+ this.updateDragStatus();
+ this.togglePointerEvents();
+ overlayLockedChkEle.checked = overlayLocked;
+
+ // opacity
+ var savedOpacity = this.getPref("pixelPerfect.opacity");
+ // opacity = this.roundNumber(savedOpacity, 1);
+ //this.updateOverlayOpacity();
+
+ var draggablePP = mainDocument.createElement("script");
+ draggablePP.setAttribute("type", "text/javascript");
+ draggablePP.setAttribute("id", draggableScriptId);
+ draggablePP.innerHTML = "var overlayDiv = document.getElementById('pp_overlay');Drag.init(overlayDiv);overlayDiv.onDrag = function(x, y){pixelPerfect.publicDocument.notifyPanelOverlayPositionHasChanged();};overlayDiv.onDragEnd = function(x, y){pixelPerfect.publicDocument.notifyPanelOverlayPositionHasChanged(); pixelPerfect.publicDocument.notifyToSaveLastPosition();};"
+
+ this.appendScriptElementAsChild(draggablePP, pageBody);
+ //this.updatePanelDisplayOfXAndY(this.getPref("pixelPerfect.lastXPos"), this.getPref("pixelPerfect.lastYPos"));
+
+ // save last overlay
+ this.setPrefValue("pixelPerfect.lastOverlayFileName", overlayUrl);
+ },
+
+ appendScriptElementAsChild: function(scriptElement, parentElement){
+ parentElement.appendChild(scriptElement);
+ },
+
+ removeChildElement: function(childElement, parentElement){
+ if (childElement != null) {
+ parentElement.removeChild(childElement);
+ }
+ },
+
+ deleteOverlay: function(eyeLiId, eyeDivId, fileName){
+ var panelDocument = this.getDocuments().panel,
+ mainDocument = this.getDocuments().main;
+ var eyeDiv = panelDocument.getElementById(eyeDivId);
+ if (eyeDiv.className == "eye-on-img") {
+ var pageBody = mainDocument.getElementsByTagName("body")[0];
+ var pixelperfect = mainDocument.getElementById(overlayDivId);
+ pageBody.removeChild(pixelperfect);
+ }
+
+ var eyeDiv = panelDocument.getElementById(eyeLiId);
+ panelDocument.getElementById("overlay-list").removeChild(eyeDiv);
+ this.deleteFile(fileName);
+ },
+
+ deleteFile: function(fileToDelete){
+ var deleteFile = this.getFirefoxProfileRootFolder().clone();
+ deleteFile.append('extensions');
+ deleteFile.append('pixelperfectplugin@openhouseconcepts.com');
+ deleteFile.append('chrome');
+ deleteFile.append('pixelperfect');
+ deleteFile.append('content');
+ deleteFile.append('user_overlays');
+ deleteFile.append(fileToDelete);
+ try {
+ deleteFile.remove(false);
+ }
+ catch (e) {
+ alert(e);
+ }
+ },
+
+ getImageDimensions: function(overlayUrl){
+ var overlayImage = new Image();
+ overlayImage.src = overlayUrl;
+ var width = overlayImage.width;
+ var height = overlayImage.height;
+
+ if (width == null || width == '0' || height == null || height == '0') {
+ width = '1280';
+ height = '1024';
+ }
+
+ return [width + 'px', height + 'px'];
+ },
+
+ getFirefoxProfileRootFolder: function(){
+ // get the nsIFile obj => user's home (profile) directory
+ const DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1", "nsIProperties");
+ var nsIFileObj;
+ try {
+ nsIFileObj = (new DIR_SERVICE()).get("ProfD", Components.interfaces.nsIFile);
+ }
+ catch (e) {
+ alert("error");
+ }
+ return nsIFileObj;
+ },
+
+ opacitySliderUpdate: function() {
+ var sliderRawValue = this.getDocuments().panel.getElementById('opacity-slider').value,
+ opacitySliderValue = null;
+
+ if (sliderRawValue == 0 || isNaN(sliderRawValue)) {
+ opacitySliderValue = 0;
+ } else {
+ opacitySliderValue = sliderRawValue / 100;
+ }
+
+ // opacity = opacitySliderValue;
+
+ // update current overlay opacity
+ var pixelperfect = this.getDocuments().main.getElementById('pp_overlay');
+ pixelperfect.style.opacity = opacitySliderValue;
+ pixelperfect.style.MozOpacity = opacitySliderValue;
+
+ // persist opacity pref
+ this.setPrefValue("pixelPerfect.opacity", opacitySliderValue);
+ },
+
+ roundNumber: function(num, dec){
+ var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+ return result;
+ },
+
+ leftArrowMove: function(){
+ var newXPos = (this.findPixelPerfectXPos() - 1);
+ this.moveX(newXPos);
+ },
+
+ rightArrowMove: function(){
+ var newXPos = (this.findPixelPerfectXPos() + 1);
+ this.moveX(newXPos);
+ },
+
+ topArrowMove: function(){
+ var newYPos = (this.findPixelPerfectYPos() - 1);
+ this.moveY(newYPos);
+ },
+
+ bottomArrowMove: function(){
+ var newYPos = (this.findPixelPerfectYPos() + 1);
+ this.moveY(newYPos);
+ },
+
+ togglePositionLock: function(chkEle) {
+ FBTrace.sysout("pixelPerfect; PixelPerfectPanelActionsModule.togglePositionLock");
+ //Firebug.PPLockAnimationModule.run();
+ overlayLocked = chkEle.checked;
+ this.updateDragStatus();
+ this.togglePointerEvents();
+ this.setPrefValue("pixelPerfect.overlayLocked", overlayLocked);
+ },
+
+ updateZIndex: function(zIndexInputEle) {
+ var zIndexInputEle = this.getDocuments().panel.getElementById('z-index-input'),
+ ppOverlayEle = this.getDocuments().main.getElementById('pp_overlay');
+ ppOverlayEle.style.zIndex = zIndexInputEle.value;
+ this.setPrefValue("pixelPerfect.zIndex", zIndexInputEle.value);
+ },
+
+ togglePointerEvents: function () {
+ var pp_overlay = this.getDocuments().main.getElementById('pp_overlay');
+ var pointerEventsVal = (overlayLocked) ? 'none' : 'auto';
+ pp_overlay.style.pointerEvents = pointerEventsVal;
+ },
+
+ updateDragStatus: function() {
+ var mainDocument = this.getDocuments().main;
+
+ var pageBody = mainDocument.getElementsByTagName("body")[0];
+ //remove previous
+ var updateDragStatusScriptID = "update-drag-status";
+ var existingDragStatusScript = mainDocument.getElementById(updateDragStatusScriptID);
+ this.removeChildElement(existingDragStatusScript, pageBody);
+
+ // add new drag status (which will lock/unlock dragging based on state of overlayLocked instance)
+ var dragStatusScript = mainDocument.createElement("script");
+ dragStatusScript.setAttribute("type", "text/javascript");
+ dragStatusScript.setAttribute("id", updateDragStatusScriptID);
+ dragStatusScript.innerHTML = "Drag.disabled = " + overlayLocked;
+
+ this.appendScriptElementAsChild(dragStatusScript, pageBody);
+ },
+
+ moveX: function(xPos){
+ this.moveElement(xPos, this.findPixelPerfectYPos());
+ },
+
+ moveY: function(yPos){
+ this.moveElement(this.findPixelPerfectXPos(), yPos);
+ },
+
+ moveElement: function(xPos, yPos){
+ if(!overlayLocked) {
+ //this.updatePanelDisplayOfXAndY(xPos, yPos);
+ this.setPrefValue("pixelPerfect.lastXPos", xPos);
+ this.setPrefValue("pixelPerfect.lastYPos", yPos);
+
+ pp_overlay = this.getDocuments().main.getElementById('pp_overlay');
+ pp_overlay.style.top = yPos + 'px';
+ pp_overlay.style.left = xPos + 'px';
+ }
+ },
+
+ findPixelPerfectXPos: function(){
+ return this.findPixelPerfectPos()[0];
+ },
+
+ findPixelPerfectYPos: function(){
+ return this.findPixelPerfectPos()[1];
+ },
+
+ findPixelPerfectPos: function(){
+ return this.findPos(this.getDocuments().main.getElementById('pp_overlay'));
+ },
+
+ findPos: function(obj){
+ var curleft = curtop = 0;
+ if (obj.offsetParent) {
+ do {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ }
+ while (obj = obj.offsetParent);
+ return [curleft, curtop];
+ }
+ },
+
+ //@deprecated
+ updatePanelDisplayOfXAndY: function(xPos, yPos){
+ // var xPosNumber = this.getDocuments().panel.getElementById('ctl-left-position');
+ // xPosNumber.innerHTML = xPos;
+
+ // var yPosNumber = this.getDocuments().panel.getElementById('ctl-top-position');
+ // yPosNumber.innerHTML = yPos;
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.PixelPerfectPanelActionsModule);
+
+return Firebug.PixelPerfectPanelActionsModule;
+
+// ********************************************************************************************* //
+});
View
198 not_used/srcExtension/chrome/content/pixelPerfectUtilsModule.js
@@ -0,0 +1,198 @@
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+ "pixelperfect/pixelPerfectFileModule"
+],
+function(FBL, FBTrace) {
+
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.PixelPerfectUtilsModule = FBL.extend(Firebug.Module,
+{
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectUtilsModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_PIXELPERFECT)
+ FBTrace.sysout("pixelPerfect; PixelPerfectUtilsModule.shutdown");
+ },
+
+ createJsElement: function(url, doc) {
+ var element = doc.createElement("script");
+ element.type = "text/javascript";
+ element.src = url;
+ return element;
+ },
+
+ shortenFileNameTo: function(fileName, length, ellipsesStr) {
+ if(fileName.length < length) {
+ return fileName;
+ } else {
+ var positionOfExtension = fileName.indexOf('.');
+ var extension = fileName.substring(positionOfExtension, fileName.length);
+ var newFileName = fileName.substring(0, positionOfExtension-1);
+ newFileName = fileName.substring(0, length-3);
+ newFileName = newFileName + ellipsesStr + extension;
+ return newFileName;
+ }
+ },
+
+ roundNumber: function(num, dec){
+ var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+ return result;
+ },
+
+ toggleStatusBar: function(bHide) {
+ FirebugChrome.window.document.getElementById('ppStatusBar').hidden = bHide;
+ },
+
+ loadCss: function(url, doc) {
+ if ( ! doc ) {
+ doc = Firebug.currentContext.pixelperfectContext.browserDoc;
+ }
+
+ var newCss = doc.createElement("link");
+ newCss.rel = "stylesheet";
+ newCss.type = "text\/css";
+ newCss.href = url;
+ doc.body.appendChild(newCss);
+
+ return newCss;
+ },
+
+ loadJs: function(url, doc) {
+ if ( ! doc ) {
+ doc = Firebug.currentContext.pixelPerfectContext.browserDoc;
+ }
+
+ var element = doc.createElement("script");
+ element.src = url;
+ doc.body.appendChild(element);
+
+ return element;
+ },
+
+ //FIXME: Make sure js element does not already exist to avoid duplicates
+ loadRequiredJsIntoToMainBrowserOverlay: function() {
+ var doc = window._content.document;
+ var pageHead = doc.getElementsByTagName("head")[0];
+ var scripts = ['dom-drag.js', 'publicDocumentEvents.js'];
+ for(i=0; i<scripts.length; i++) {
+ pageHead.appendChild(this.createJsElement('chrome://pixelperfect/content/browserscripts/' + scripts[i], doc));
+ }
+ },
+
+ setVisibilityForOverlay: function(thePanelIsPixelPerfect) {
+ var x = window.content;
+ var pixelperfect = x.document.getElementById("pp_overlay");
+ if(pixelperfect != null) {
+ if(thePanelIsPixelPerfect) {
+ pixelperfect.style.visibility = 'visible';
+ } else {
+ pixelperfect.style.visibility = 'hidden';
+ }
+ }
+ },
+
+ buildEyeElementData: function(doc) {
+ var currentOverlayFiles = Firebug.PixelPerfectFileModule.getCurrentOverlayFiles(),
+ eyeElementData = [],
+ currentOverlay;
+
+ for (i = 0; i < currentOverlayFiles.length; i++) {
+ eyeElementData.push(this.getOverlayElementLiteral(currentOverlayFiles[i]));
+ }
+
+ return eyeElementData;
+ },
+
+ getOverlayElementLiteral: function(overlayName) {
+ var formattedID = overlayName.replace(/(\.|\s|-)/gi, "_").toLowerCase(),
+ fileNameForDisplay = this.shortenFileNameTo(overlayName, 15, '***');
+
+
+
+ return {id: formattedID, file: overlayName, displayLabel: fileNameForDisplay, thumbPath: 'chrome://pixelperfect/content/user_overlays/' + overlayName};
+ },
+
+ fireEyeClickEvent: function(eyeEleId, doc) {
+ var fireOnThisEye = doc.getElementById(eyeEleId);
+ if(fireOnThisEye != null && eyeEleId != undefined && eyeEleId != '') {
+ var evObj = doc.createEvent('MouseEvents');
+ evObj.initEvent( 'click', true, true );
+ fireOnThisEye.dispatchEvent(evObj);
+ }
+ },
+
+ /**
+ * Get a handle to a service.
+ * @param {string} className The class name.
+ * @param {string} interfaceName The interface name.
+ */
+ CCSV: function(className, interfaceName) {
+ var classObj = Components.classes[className];
+ var ifaceObj = Components.interfaces[interfaceName];
+ if (!classObj || !ifaceObj) {
+ return null;
+ }
+ return classObj.getService(ifaceObj);
+ },
+
+ /**
+ * Get the browser preferences object.
+ */
+ getPrefs: function() {
+ return this.CCSV('@mozilla.org/preferences-service;1', 'nsIPrefBranch');
+ },
+
+ /**
+ * Check if a boolean preference is set. If so, return its value.
+ * If not, return the default value passed as an argument.
+ * @param {string} prefName The name of the preference to fetch.
+ * @param {boolean} opt_defaultValue The default value to use if the
+ * pref is undefined or not a boolean.
+ * @return {boolean} The preference value.
+ */
+ getBoolPref: function(prefName, opt_defaultValue) {
+ var prefs = this.getPrefs();
+ if (prefs.getPrefType(prefName) == prefs.PREF_BOOL) {
+ return prefs.getBoolPref(prefName);
+ } else {
+ return opt_defaultValue || false;
+ }
+ },
+
+ /**
+ * Set a boolean preference. Create the pref if necessary, and overwrite
+ * an existing pref if necessary.
+ * @param {string} prefName The name of the preference to set.
+ * @param {boolean|undefined|null} value The value to set the pref to.
+ */
+ setBoolPref: function(prefName, value) {
+ this.getPrefs().setBoolPref(prefName, value);
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.PixelPerfectUtilsModule);
+
+return Firebug.PixelPerfectUtilsModule;
+
+// ********************************************************************************************* //
+});
View
87 not_used/srcExtension/chrome/content/ppLockAnimationModule.js
@@ -0,0 +1,87 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/lib",
+ "firebug/lib/trace",
+],
+function(FBL, FBTrace) {
+
+// var frame = 0,
+ // directionForward = true,
+ // animationSpeed = 10,
+ // spriteSpacing = 170;
+// ********************************************************************************************* //
+// Custom Module Implementation
+
+Firebug.PPLockAnimationModule = FBL.extend(Firebug.Module,
+{
+
+ this.frame = 0;
+ this.directionForward = true;
+ this.animationSpeed = 10;
+ this.spriteSpacing = 170;
+ this.refreshId = null;
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Initialization
+
+ initialize: function(owner)
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+
+ // TODO: Module initialization (there is one module instance per browser window)
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("pixelPerfect; PPLockAnimationModule.initialize");
+ },
+
+ shutdown: function()
+ {
+ Firebug.Module.shutdown.apply(this, arguments);
+
+ if (FBTrace.DBG_HELLOAMD)
+ FBTrace.sysout("pixelPerfect; PPLockAnimationModule.shutdown");
+ },
+
+ run: function() {
+ FBTrace.sysout("pixelPerfect; PPLockAnimationModule.run");
+ FBTrace.sysout("pixelPerfect; PPLockAnimationModule.run :: current frame => " + frame);
+
+ this.refreshId = setInterval(this.animateNext, this.animationSpeed);
+ },
+
+ //TODO: Move this to it's own module
+ animateNext: function() {
+ FBTrace.sysout("pixelPerfect; PPLockAnimationModule.animateNext :: current frame => " + this.frame);
+ if(this.directionForward && this.frame === 31) {
+ clearInterval(this.refreshId);
+ this.directionForward = false;
+ this.frame = 30;
+ } else if(!this.directionForward && frame === -1) {
+ clearInterval(refreshId);
+ this.directionForward = true;
+ this.frame = 0;
+ } else {
+ var top = -1 * (this.spriteSpacing * this.frame);
+ // positionControls
+ var positionControls = this.getDocuments().panel.getElementById('position-controls');
+ positionControls.style.backgroundPosition="'-0px '+top+'px'";
+ //$('#position-controls').css('backgroundPosition','-0px '+top+'px');
+ if(this.directionForward) {
+ this.frame++;
+ } else {
+ this.frame--;
+ }
+ }
+ }
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(Firebug.PPLockAnimationModule);
+
+return Firebug.PPLockAnimationModule;
+
+// ********************************************************************************************* //
+});
View
666 not_used/srcExtension/chrome/content/slider.js
@@ -0,0 +1,666 @@
+/*
+ Unobtrusive Slider Control by frequency decoder v1.4 (http://www.frequency-decoder.com/)
+
+ Released under a creative commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/)
+
+ You are free:
+
+ * to copy, distribute, display, and perform the work
+ * to make derivative works
+ * to make commercial use of the work
+
+ Under the following conditions:
+
+ by Attribution.
+ --------------
+ You must attribute the work in the manner specified by the author or licensor.
+
+ sa
+ --
+ Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
+
+ * For any reuse or distribution, you must make clear to others the license terms of this work.
+ * Any of these conditions can be waived if you get permission from the copyright holder.
+*/
+
+var fdSliderController;
+
+(function() {
+
+ function fdSlider(inp,range,callback,classname,hide,tween,vertical, document) {
+
+ this._inp = inp;
+ this._hideInput = hide;
+ this._min = range[0]||0;
+ this._max = range[1]||0;
+ this._range = this._max - this._min;
+ this._tween = tween;
+ this._mouseX = 0;
+ this._timer = null;
+ this._classname = classname;
+ this._drag = false;
+ this._kbEnabled = true;
+ this._callback = callback;
+ this._vertical = vertical;
+ this._steps = inp.tagName.toLowerCase() == "input" ? 10 : inp.options.length - 1;
+ this._resizeVal = 0;
+
+ // ARIA namespaces
+ this.NS_XHTML = "http://www.w3.org/1999/xhtml";
+ this.NS_STATE = "http://www.w3.org/2005/07/aaa";
+
+ this.events = {
+ stopevent: function(e) {
+ if(e == null) e = document.parentWindow.event;
+ if(e.stopPropagation) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
+ /*@cc_on@*/
+ /*@if(@_win32)
+ e.cancelBubble = true;
+ e.returnValue = false;
+ /*@end@*/
+ return false;
+ },
+ redrawEvent:function(e) {
+ // Get around IE's window.resize bug by testing if the actual size of the wrapper has changed...
+ if((self._vertical && self.outerWrapper.offsetHeight != self._resizeVal) || (!self._vertical && self.outerWrapper.offsetWidth != self._resizeVal)) {
+ self.events.redraw();
+ };
+ },
+ redraw: function() {
+ self.locate();
+
+ // Internet Explorer requires the try catch
+ try {
+ var sW = self.outerWrapper.offsetWidth;
+ var sH = self.outerWrapper.offsetHeight;
+ var hW = self.handle.offsetWidth;
+ var hH = self.handle.offsetHeight;
+ var bH = self.bar.offsetHeight;
+ var bW = self.bar.offsetWidth;
+ var sI = self._steps;
+
+ if(self._vertical) {
+ self.bar.style.height = Math.round(sH - hH) + "px";
+ self.bar.style.left = Math.floor((sW - bW) / 2) + "px";
+ self.bar.style.top = Math.round(hH / 2) + "px";
+ self._incPx = (sH - hH) / sI < 1 ? 1 : (sH - hH) / sI;
+ } else {
+ self.bar.style.width = Math.round(sW - hW) + "px";
+ self.bar.style.left = Math.round(hW / 2) + "px";
+ self.bar.style.top = Math.floor((sH - bH) / 2) + "px";
+ self._incPx = (sW - hW) / sI < 1 ? 1 : (sW - hW) / sI;
+ };
+ self.resetHandlePosition();
+ self._resizeVal = (self._vertical) ? sH : sW;
+ } catch(err) { };
+ },
+ onfocus: function(e) {
+ self.outerWrapper.className = self.outerWrapper.className.replace('focused','') + ' focused';
+
+ fdSliderController.addEvent(window, 'DOMMouseScroll', self.events.trackmousewheel);
+ fdSliderController.addEvent(document, 'mousewheel', self.events.trackmousewheel);
+ if(!window.opera) fdSliderController.addEvent(window, 'mousewheel', self.events.trackmousewheel);
+
+ self.doCallback();
+ },
+ onblur: function(e) {
+ self.outerWrapper.className = self.outerWrapper.className.replace(/focused|fd-fc-slider-hover|fd-slider-hover/g,'');
+
+ fdSliderController.removeEvent(document, 'mousewheel', self.events.trackmousewheel);
+ fdSliderController.removeEvent(window, 'DOMMouseScroll', self.events.trackmousewheel);
+ if(!window.opera) fdSliderController.removeEvent(window, 'mousewheel', self.events.trackmousewheel);
+ },
+ trackmousewheel: function(e) {
+ if(!self._kbEnabled) return;
+ var delta = 0;
+ var e = e || window.event;
+ if (e.wheelDelta) {
+ delta = e.wheelDelta/120;
+ if (window.opera && window.opera.version() < 9.2) delta = -delta;
+ } else if(e.detail) {
+ delta = -e.detail/3;
+ };
+ if(delta) {
+ var xtmp = self._vertical ? self.handle.offsetTop : self.handle.offsetLeft;
+ var wtmp = self._vertical ? self.outerWrapper.offsetHeight - self.handle.offsetHeight : self.outerWrapper.offsetWidth - self.handle.offsetWidth;
+ var inc = self._inp.tagName.toLowerCase() == "input" ? Math.round(self._incPx / 2) < 1 ? 1 : Math.round(self._incPx / 2) : self._incPx;
+ if(self._vertical) inc = -inc;
+ if(delta < 0) {
+ xtmp += inc;
+ xtmp = Math.ceil(xtmp);
+ } else {
+ xtmp -= inc;
+ xtmp = Math.floor(xtmp);
+ };
+ if(xtmp < 0) xtmp = 0;
+ else if(xtmp > wtmp) xtmp = wtmp;
+
+ if(self._vertical) self.handle.style.top = xtmp + "px";
+ else self.handle.style.left = xtmp + "px";
+ self.updateInput(xtmp);
+ };
+ return self.events.stopevent(e);
+ },
+ onkeypress: function(e) {
+ if (e == null) e = document.parentWindow.event;
+ if ((e.keyCode >= 35 && e.keyCode <= 40) || !self._kbEnabled) {
+ return self.events.stopevent(e);
+ };
+ },
+ onkeydown: function(e) {
+ if(!self._kbEnabled) return true;
+
+ if(e == null) e = document.parentWindow.event;
+ var kc = e.keyCode != null ? e.keyCode : e.charCode;
+
+ if ( kc < 35 || kc > 40 ) return true;
+
+ var xtmp = self._vertical ? self.handle.offsetTop : self.handle.offsetLeft;
+ var wtmp = self._vertical ? self.outerWrapper.offsetHeight - self.handle.offsetHeight : self.outerWrapper.offsetWidth - self.handle.offsetWidth;
+ var inc = self._inp.tagName.toLowerCase() == "input" ? Math.round(self._incPx / 2) < 1 ? 1 : Math.round(self._incPx / 2) : self._incPx;
+
+ if(self._vertical) inc = -inc;
+
+ if( kc == 37 || kc == 40 ) {
+ // left, up
+ xtmp -= inc;
+ xtmp = Math.floor(xtmp);
+ } else if( kc == 39 || kc == 38) {
+ // right, down
+ xtmp += inc;
+ xtmp = Math.ceil(xtmp);
+ } else if( kc == 35 ) {
+ // max
+ xtmp = wtmp;
+ } else if( kc == 36 ) {
+ // min
+ xtmp = 0;
+ }
+
+ if(xtmp < 0) xtmp = 0;
+ else if(xtmp > wtmp) xtmp = wtmp;
+
+ self.handle.style[self._vertical ? "top" : "left"] = xtmp + "px";
+ self.updateInput(xtmp);
+
+ // Opera doesn't let us cancel key events so the up/down arrows and home/end buttons will scroll the screen - which sucks
+ return self.events.stopevent(e);
+ },
+ onchange: function( e ) {
+ self.resetHandlePosition();
+ self.doCallback();
+ return true;
+ },
+ onmouseover: function( e ) {
+ /*@cc_on@*/
+ /*@if(@_jscript_version <= 5.6)
+ if(this.className.search(/focused/) != -1) {
+ this.className = this.className.replace("fd-fc-slider-hover", "") +' fd-fc-slider-hover';
+ return;
+ }
+ /*@end@*/
+ this.className = this.className.replace(/fd\-slider\-hover/g,"") +' fd-slider-hover';
+ },
+ onmouseout: function( e ) {
+ /*@cc_on@*/
+ /*@if(@_jscript_version <= 5.6)
+ if(this.className.search(/focused/) != -1) {
+ this.className = this.className.replace("fd-fc-slider-hover", "");
+ return;
+ }
+ /*@end@*/
+ this.className = this.className.replace(/fd\-slider\-hover/g,"");
+ },
+ onHmouseup:function(e) {
+ e = e || window.event;
+ fdSliderController.removeEvent(document, 'mousemove', self.events.trackmouse);
+ fdSliderController.removeEvent(document, 'mouseup', self.events.onHmouseup);
+ self._drag = false;
+ self._kbEnabled = true;
+
+ // Opera fires the blur event when the mouseup event occurs on a button, so we attept to force a focus
+ if(window.opera) try { setTimeout(function() { self.events.onfocus(); }, 0); } catch(err) {};
+
+ return self.events.stopevent(e);
+ },
+ onHmousedown: function(e) {
+ e = e || window.event;
+ self._mouseX = self._vertical ? e.clientY : e.clientX;
+ self.handleX = parseInt(self._vertical ? self.handle.offsetTop : self.handle.offsetLeft)||0;
+ self._drag = true;
+ self._kbEnabled = false;
+
+ fdSliderController.addEvent(document, 'mousemove', self.events.trackmouse);
+ fdSliderController.addEvent(document, 'mouseup', self.events.onHmouseup);
+
+ // Safari will not "focus" on the button on mouse events, so we attempt to force a focus
+ if(window.devicePixelRatio || (document.all && !window.opera)) try { setTimeout(function() { self.handle.focus(); }, 0); } catch(err) {};
+ },
+ onmouseup: function( e ) {
+ e = e || window.event;
+ fdSliderController.removeEvent(document, 'mouseup', self.events.onmouseup);
+ if(!self._tween) {
+ clearTimeout(self._timer);
+ self._timer = null;
+ self._kbEnabled = true;
+ }
+ self.doCallback();
+ return self.events.stopevent(e);
+ },
+ trackmouse: function( e ) {
+ if (!e) var e = window.event;
+ var x = self._vertical ? self.handleX + (e.clientY-self._mouseX) : self.handleX + (e.clientX-self._mouseX);
+ if(x < 0) x = 0;
+ var max = self._vertical ? self.outerWrapper.offsetHeight - self.handle.offsetHeight : self.outerWrapper.offsetWidth - self.handle.offsetWidth;
+ if(x > max) x = max;
+ if(self._vertical) self.handle.style.top = x + "px";
+ else self.handle.style.left = x + "px";
+ self.updateInput(x);
+ },
+ onmousedown: function( e ) {
+ var targ;
+ if (!e) var e = window.event;
+ if (e.target) targ = e.target;
+ else if (e.srcElement) targ = e.srcElement;
+ if (targ.nodeType == 3) targ = targ.parentNode;
+
+ if(targ.className.search("fd-slider-handle") != -1) {
+ return true;
+ };
+
+ try { setTimeout(function() { self.handle.focus(); }, 0); } catch(err) {};
+
+ clearTimeout(self._timer);
+ self._timer = null;
+ self._kbEnabled = false;
+ self.locate();
+ self._drag = false;
+ var posx = 0;
+ var sLft = 0;
+ var sTop = 0;
+
+ // Internet Explorer doctype woes
+ if (document.documentElement && document.documentElement.scrollTop) {
+ sTop = document.documentElement.scrollTop;
+ sLft = document.documentElement.scrollLeft;
+ } else if (document.body) {
+ sTop = document.body.scrollTop;
+ sLft = document.body.scrollLeft;
+ };
+
+ if (e.pageX) posx = self._vertical ? e.pageY : e.pageX;
+ else if (e.clientX) posx = self._vertical ? e.clientY + sTop : e.clientX + sLft;
+
+ var diff = Math.round((self._vertical) ? self.handle.offsetHeight / 2 : self.handle.offsetWidth / 2);
+ posx -= self._vertical ? self._y + diff : self._x + diff;
+
+ if(posx < 0) posx = 0;
+ else if(!self._vertical && posx > self.outerWrapper.offsetWidth - self.handle.offsetWidth) posx = self.outerWrapper.offsetWidth - self.handle.offsetWidth;
+ else if(self._vertical && posx > self.outerWrapper.offsetHeight - self.handle.offsetHeight) posx = self.outerWrapper.offsetHeight - self.handle.offsetHeight;
+
+ if(self._tween) {
+ self.tweenTo(posx);
+ } else {
+ fdSliderController.addEvent(document, 'mouseup', self.events.onmouseup);
+ self._posx = posx;
+ self.onTimer();
+ };
+ }
+ };
+
+ this.onTimer = function() {
+ var xtmp = self._vertical ? self.handle.offsetTop : self.handle.offsetLeft;
+ if(self._posx < xtmp) {
+ xtmp -= self._incPx;
+ xtmp = Math.floor(xtmp);
+ if(xtmp < self._posx) xtmp = self._posx;
+ } else {
+ xtmp += self._incPx;
+ xtmp = Math.ceil(xtmp);
+ if(xtmp > self._posx) xtmp = self._posx;
+ };
+ xtmp = Math.round(xtmp);
+ self.handle.style[self._vertical ? "top" : "left"] = xtmp + "px";
+ self.updateInput(xtmp);
+ if(xtmp != self._posx) self._timer = setTimeout(self.onTimer, 200);
+ else self._kbEnabled = true;
+ };
+
+ this.locate = function(){
+ var curleft = 0;
+ var curtop = 0;
+ var obj = self.outerWrapper;
+ // Try catch for IE's benefit
+ try {
+ while (obj.offsetParent) {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ obj = obj.offsetParent;
+ };
+ } catch(err) {}
+ self._x = curleft;
+ self._y = curtop;
+ };
+