~ubuntu-branches/ubuntu/lucid/webdeveloper/lucid-proposed

« back to all changes in this revision

Viewing changes to source/content_common/webdeveloper/dialogs/resize.js

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2009-01-04 12:25:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090104122500-agtub7j8tfr3s09t
Tags: 1.1.6+repack-1ubuntu1
* Merge from Debian experimental, remaining Ubuntu changes:
  + debian/control:
    - Build firefox-webdeveloper and adjust it for Firefox.
    - Do not conflict/replaces with firefox-developer.
    - Add Vcs-Bzr header.
  + debian/rules:
    - Adjust makebuilddir to build firefox-webdeveloper package.
  + Rename iceweasel-{webdeveloper.links,firefox-webdeveloper.install} to
    firefox-{webdeveloper.links,firefox-webdeveloper.install}

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Initializes the resize dialog
 
2
function webdeveloper_initializeResize()
 
3
{
 
4
    var resizeViewport = webdeveloper_getBooleanPreference("webdeveloper.resize.viewport", true);
 
5
 
 
6
    document.getElementById("webdeveloper-resize-viewport").checked = resizeViewport;
 
7
 
 
8
    // If resizing the viewport
 
9
    if(resizeViewport)
 
10
    {
 
11
        document.getElementById("webdeveloper-resize-width").value  = window.arguments[2];
 
12
        document.getElementById("webdeveloper-resize-height").value = window.arguments[3];
 
13
    }
 
14
    else
 
15
    {
 
16
        document.getElementById("webdeveloper-resize-width").value  = window.arguments[0];
 
17
        document.getElementById("webdeveloper-resize-height").value = window.arguments[1];
 
18
    }
 
19
}
 
20
 
 
21
// Resizes the parent window to the given width and height
 
22
function webdeveloper_resizeParentWindow()
 
23
{
 
24
    var height = document.getElementById("webdeveloper-resize-height").value.trim();
 
25
    var width  = document.getElementById("webdeveloper-resize-width").value.trim();
 
26
 
 
27
    // If the width and height are valid
 
28
    if(width && height && (width == "*" || (parseInt(width) == width && width > 0)) && (height == "*" || (parseInt(height) == height && height > 0)))
 
29
    {
 
30
        var contentWindow = window.opener.content;
 
31
        var windowX       = window.opener.screenX;
 
32
        var windowY       = window.opener.screenY;
 
33
 
 
34
        // If resizing the view port
 
35
        if(document.getElementById("webdeveloper-resize-viewport").checked)
 
36
        {
 
37
            webdeveloper_setBooleanPreferenceIfNotSet("webdeveloper.resize.viewport", true);
 
38
 
 
39
            // If the width is not a wildcard
 
40
            if(width != "*")
 
41
            {
 
42
                contentWindow.innerWidth  = width;
 
43
            }
 
44
 
 
45
            // If the height is not a wildcard
 
46
            if(height != "*")
 
47
            {
 
48
                contentWindow.innerHeight = height;
 
49
            }
 
50
        }
 
51
        else
 
52
        {
 
53
            // If the resize viewport preference is set
 
54
            if(webdeveloper_isPreferenceSet("webdeveloper.resize.viewport"))
 
55
            {
 
56
                webdeveloper_deletePreference("webdeveloper.resize.viewport");
 
57
            }
 
58
 
 
59
            // If the width is a wildcard
 
60
            if(width == "*")
 
61
            {
 
62
                width = contentWindow.outerWidth;
 
63
            }
 
64
 
 
65
            // If the height is a wildcard
 
66
            if(height == "*")
 
67
            {
 
68
                height = contentWindow.outerHeight;
 
69
            }
 
70
 
 
71
            window.opener.resizeTo(width, height);
 
72
        }
 
73
 
 
74
        window.opener.screenX = windowX;
 
75
        window.opener.screenY = windowY;
 
76
    }
 
77
}