diff options
author | redmatrix <git@macgirvin.com> | 2016-04-13 16:31:06 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-13 16:31:06 -0700 |
commit | 9a0b61e4afed94727679eee966afb76e1add2beb (patch) | |
tree | 76f5b8d6e29fe8ffe543c75064a5e8e2e384f10c /Zotlabs/Web | |
parent | a8a0ca82913a923ce2a08e1cb41305b66cf35e24 (diff) | |
download | volse-hubzilla-9a0b61e4afed94727679eee966afb76e1add2beb.tar.gz volse-hubzilla-9a0b61e4afed94727679eee966afb76e1add2beb.tar.bz2 volse-hubzilla-9a0b61e4afed94727679eee966afb76e1add2beb.zip |
refactor the js detection into a checkjs class which is only enabled on demand (currently only the channel and display pages). Will probably require a bit more work to hide/disable the cover photo when js is disabled. Have not actually tested without js to discover any other potential page issues. Have only confirmed that the detection class works and redirects to set a jsdisabled cookie and reload the page with that cookie+variable set if called from the channel page.
Diffstat (limited to 'Zotlabs/Web')
-rw-r--r-- | Zotlabs/Web/CheckJS.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Zotlabs/Web/CheckJS.php b/Zotlabs/Web/CheckJS.php new file mode 100644 index 000000000..3ad5fc1ed --- /dev/null +++ b/Zotlabs/Web/CheckJS.php @@ -0,0 +1,36 @@ +<?php + +namespace Zotlabs\Web; + + +class CheckJS { + + private static $jsdisabled = 0; + + function __construct($test = 0) { + if(intval($_REQUEST['jsdisabled'])) + $this->jsdisabled = 1; + if(intval($_COOKIE['jsdisabled'])) + $this->jsdisabled = 1; + + if(! $this->jsdisabled) { + $page = urlencode(\App::$query_string); + + if($test) { + \App::$page['htmlhead'] .= "\r\n" . '<meta http-equiv="refresh" content="0; url=' . z_root() . '/nojs?f=&redir=' . $page . '">' . "\r\n"; + } + else { + \App::$page['htmlhead'] .= "\r\n" . '<noscript><meta http-equiv="refresh" content="0; url=' . z_root() . '/nojs?f=&redir=' . $page . '"></noscript>' . "\r\n"; + } + } + + } + + function disabled() { + return self::$jsdisabled; + } + + +} + + |