diff --git a/NEWS b/NEWS index 3a17ee96..952fab9a 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ special versions for the old behavior * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and VimperatorLeave respectively + * add 'Fullscreen' autocommmand * add :colorscheme * multibyte support for hints (thanks Xie&Tian) * add 'exrc' diff --git a/content/buffer.js b/content/buffer.js index 27432c87..c01d8c65 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -133,11 +133,7 @@ function Buffer() //{{{ "Show the current window fullscreen", "boolean", false, { - setter: function (value) - { - window.fullScreen = value; - return value; - }, + setter: function (value) window.fullScreen = value, getter: function () window.fullScreen }); diff --git a/content/events.js b/content/events.js index 721631e1..8c8dc07a 100644 --- a/content/events.js +++ b/content/events.js @@ -269,6 +269,8 @@ function Events() //{{{ const input = liberator.input; + var fullscreen = window.fullScreen; + var inputBufferLength = 0; // count the number of keys in v.input.buffer (can be different from v.input.buffer.length) var skipMap = false; // while feeding the keys (stored in v.input.buffer | no map found) - ignore mappings @@ -360,6 +362,7 @@ function Events() //{{{ window.addEventListener("popuphidden", exitPopupMode, true); window.addEventListener("DOMMenuBarActive", enterMenuMode, true); window.addEventListener("DOMMenuBarInactive", exitMenuMode, true); + window.addEventListener("resize", onResize, true); // window.document.addEventListener("DOMTitleChanged", function (event) // { @@ -469,6 +472,16 @@ function Events() //{{{ autocommands.trigger(name, args); } + function onResize(event) + { + if (window.fullScreen != fullscreen) + { + fullscreen = window.fullScreen; + liberator.triggerObserver("fullscreen", fullscreen); + autocommands.trigger("Fullscreen", {url: "", fullscreen: fullscreen}); + } + } + function onDOMContentLoaded(event) { if (event.originalTarget instanceof HTMLDocument) diff --git a/content/vimperator.js b/content/vimperator.js index bdd92a7c..31d76900 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -43,6 +43,7 @@ const config = { //{{{ ["ColorScheme", "Triggered after a color scheme has been loaded"], ["DOMLoad", "Triggered when a page's DOM content has fully loaded"], ["DownloadPost", "Triggered when a download has completed"], + ["Fullscreen", "Triggered when the browser's fullscreen state changes"], ["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"], ["PageLoadPre", "Triggered after a page load is initiated"], ["PageLoad", "Triggered when a page gets (re)loaded/opened"], diff --git a/locale/en-US/autocommands.txt b/locale/en-US/autocommands.txt index 3cb36bd9..15978581 100644 --- a/locale/en-US/autocommands.txt +++ b/locale/en-US/autocommands.txt @@ -24,6 +24,7 @@ Available {events}: *ColorScheme* Triggered after a color scheme has been loaded *DOMLoad* Triggered when a page's DOM content has fully loaded *DownloadPost* Triggered when a download has completed +*Fullscreen* Triggered when the browser's fullscreen state changes *LocationChange* Triggered when changing tabs or when navigating to a new location *PageLoadPre* Triggered after a page load is initiated. *PageLoad* Triggered when a page gets (re)loaded/opened