From 361c12be462a3a81a17969e7e371f5ce0a156a8c Mon Sep 17 00:00:00 2001 From: Quentin Bramas Date: Wed, 4 Nov 2015 23:00:57 +0100 Subject: [PATCH 01/30] Check if a user is logged in before displaying log or seeing system information\n This resolve electerious/Lychee#420 --- plugins/check/index.php | 12 ++++++++++++ plugins/displaylog/index.php | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/plugins/check/index.php b/plugins/check/index.php index b21b087..915e7fd 100644 --- a/plugins/check/index.php +++ b/plugins/check/index.php @@ -93,6 +93,18 @@ if ($database->server_version<50500) echo('Warning: Lychee uses the GBK charset if ($error==='') echo('No critical problems found. Lychee should work without problems!' . PHP_EOL); else echo $error; +# Don't go further if the user is not connected +session_start(); +$isAdmin = ((isset($_SESSION['login'])&&$_SESSION['login']===true)&& + (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])); + +if(!$isAdmin) +{ + echo(PHP_EOL . PHP_EOL . 'You have to be logged in to see more information.'); + exit(); +} + + # Show separator echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL); echo('------------------' . PHP_EOL); diff --git a/plugins/displaylog/index.php b/plugins/displaylog/index.php index 0b6ca83..48107ff 100644 --- a/plugins/displaylog/index.php +++ b/plugins/displaylog/index.php @@ -37,6 +37,21 @@ if (mysqli_connect_errno()!=0) { exit(); } +# Load settings +$settings = new Settings($database); +$settings = $settings->get(); + +# Check if the user is connected +session_start(); +$isAdmin = ((isset($_SESSION['login'])&&$_SESSION['login']===true)&& + (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])); + +if(!$isAdmin) +{ + exit('You have to be logged in to see the log.'); +} + + # Result $query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG)); $result = $database->query($query); From db4f3d65fb9fb8ad0ebe8f34bc47b684b8702b6a Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 21 Dec 2015 15:01:19 +0100 Subject: [PATCH 02/30] User Album::prepareData to prepare an Album, even for single albums --- php/modules/Album.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/php/modules/Album.php b/php/modules/Album.php index 708dab1..1b8d1c5 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -69,14 +69,20 @@ class Album extends Module { $album['title'] = $data['title']; $album['public'] = $data['public']; + # Additional attributes + # Only part of $album when available + if (isset($data['description'])) $album['description'] = $data['description']; + if (isset($data['visible'])) $album['visible'] = $data['visible']; + if (isset($data['downloadable'])) $album['downloadable'] = $data['downloadable']; + # Parse date $album['sysdate'] = date('F Y', $data['sysstamp']); # Parse password $album['password'] = ($data['password']=='' ? '0' : '1'); - # Set placeholder for thumbs - $album['thumbs'] = array(); + # Parse thumbs or set default value + $album['thumbs'] = (isset($data['thumbs']) ? explode(',', $data['thumbs']) : array()); return $album; @@ -112,8 +118,7 @@ class Album extends Module { default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs)); $albums = $this->database->query($query); $return = $albums->fetch_assoc(); - $return['sysdate'] = date('d M. Y', $return['sysstamp']); - $return['password'] = ($return['password']=='' ? '0' : '1'); + $return = Album::prepareData($return); $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs)); break; From f87701b1c002673304a68762b97190a67af98dd3 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 21 Dec 2015 15:09:05 +0100 Subject: [PATCH 03/30] Improved loading performance by combining multiple queries #372 #241 --- php/modules/Album.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/php/modules/Album.php b/php/modules/Album.php index 1b8d1c5..d7adf97 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -194,8 +194,8 @@ class Album extends Module { if ($public===false) $return['smartalbums'] = $this->getSmartInfo(); # Albums query - if ($public===false) $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_ALBUMS)); - else $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0 ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_ALBUMS)); + if ($public===false) $query = Database::prepare($this->database, 'SELECT a.id, a.title, a.public, a.sysstamp, a.password, p.thumbs FROM (SELECT album, substring_index(GROUP_CONCAT(thumbUrl ORDER BY star DESC, ' . substr($this->settings['sortingPhotos'], 9) . '), ",", 3) AS thumbs FROM ? GROUP BY album) AS p RIGHT JOIN ? a ON p.album = a.id ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS)); + else $query = Database::prepare($this->database, 'SELECT a.id, a.title, a.public, a.sysstamp, a.password, p.thumbs FROM (SELECT album, substring_index(GROUP_CONCAT(thumbUrl ORDER BY star DESC, ' . substr($this->settings['sortingPhotos'], 9) . '), ",", 3) AS thumbs FROM ? GROUP BY album) AS p RIGHT JOIN ? a ON p.album = a.id WHERE public = 1 AND visible <> 0 ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS)); # Execute query $albums = $this->database->query($query); @@ -214,14 +214,10 @@ class Album extends Module { if (($public===true&&$album['password']==='0')|| ($public===false)) { - # Execute query - $query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sortingPhotos'], 9) . " LIMIT 3", array(LYCHEE_TABLE_PHOTOS, $album['id'])); - $thumbs = $this->database->query($query); - - # For each thumb $k = 0; - while ($thumb = $thumbs->fetch_object()) { - $album['thumbs'][$k] = LYCHEE_URL_UPLOADS_THUMB . $thumb->thumbUrl; + + foreach ($album['thumbs'] as $thumb) { + $album['thumbs'][$k] = LYCHEE_URL_UPLOADS_THUMB . $thumb; $k++; } From 6547229a3ba3662117dd6d343a3e7ae99df3b50f Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 21 Dec 2015 16:07:45 +0100 Subject: [PATCH 04/30] Added fallback sorting --- php/modules/Settings.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/php/modules/Settings.php b/php/modules/Settings.php index f0f57f4..db3e111 100755 --- a/php/modules/Settings.php +++ b/php/modules/Settings.php @@ -179,6 +179,12 @@ class Settings extends Module { } + $sorting .= ' '; + + # Append fallback sorting + # Necessary to get a consistent sorting when multiple photos have same values + $sorting .= ', id DESC'; + # Execute query # Do not prepare $sorting because it is a true statement # Preparing (escaping) the sorting would destroy it @@ -235,6 +241,12 @@ class Settings extends Module { } + $sorting .= ' '; + + # Append fallback sorting + # Necessary to get a consistent sorting when multiple albums have same values + $sorting .= ', id DESC'; + # Execute query # Do not prepare $sorting because it is a true statement # Preparing (escaping) the sorting would destroy it From 312db57f713a5b7afb25730df187bce57e7d08a6 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 29 Dec 2015 12:06:44 +0100 Subject: [PATCH 05/30] Reverted query optimization as I failed to fix the incorrect sorting cased by this http://stackoverflow.com/questions/34399798/similar-mysql-queries-returning-with-different-sorting --- php/modules/Album.php | 14 +++++++++----- php/modules/Settings.php | 12 ------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/php/modules/Album.php b/php/modules/Album.php index d7adf97..1b8d1c5 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -194,8 +194,8 @@ class Album extends Module { if ($public===false) $return['smartalbums'] = $this->getSmartInfo(); # Albums query - if ($public===false) $query = Database::prepare($this->database, 'SELECT a.id, a.title, a.public, a.sysstamp, a.password, p.thumbs FROM (SELECT album, substring_index(GROUP_CONCAT(thumbUrl ORDER BY star DESC, ' . substr($this->settings['sortingPhotos'], 9) . '), ",", 3) AS thumbs FROM ? GROUP BY album) AS p RIGHT JOIN ? a ON p.album = a.id ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS)); - else $query = Database::prepare($this->database, 'SELECT a.id, a.title, a.public, a.sysstamp, a.password, p.thumbs FROM (SELECT album, substring_index(GROUP_CONCAT(thumbUrl ORDER BY star DESC, ' . substr($this->settings['sortingPhotos'], 9) . '), ",", 3) AS thumbs FROM ? GROUP BY album) AS p RIGHT JOIN ? a ON p.album = a.id WHERE public = 1 AND visible <> 0 ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_PHOTOS, LYCHEE_TABLE_ALBUMS)); + if ($public===false) $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_ALBUMS)); + else $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0 ' . $this->settings['sortingAlbums'], array(LYCHEE_TABLE_ALBUMS)); # Execute query $albums = $this->database->query($query); @@ -214,10 +214,14 @@ class Album extends Module { if (($public===true&&$album['password']==='0')|| ($public===false)) { - $k = 0; + # Execute query + $query = Database::prepare($this->database, "SELECT thumbUrl FROM ? WHERE album = '?' ORDER BY star DESC, " . substr($this->settings['sortingPhotos'], 9) . " LIMIT 3", array(LYCHEE_TABLE_PHOTOS, $album['id'])); + $thumbs = $this->database->query($query); - foreach ($album['thumbs'] as $thumb) { - $album['thumbs'][$k] = LYCHEE_URL_UPLOADS_THUMB . $thumb; + # For each thumb + $k = 0; + while ($thumb = $thumbs->fetch_object()) { + $album['thumbs'][$k] = LYCHEE_URL_UPLOADS_THUMB . $thumb->thumbUrl; $k++; } diff --git a/php/modules/Settings.php b/php/modules/Settings.php index db3e111..f0f57f4 100755 --- a/php/modules/Settings.php +++ b/php/modules/Settings.php @@ -179,12 +179,6 @@ class Settings extends Module { } - $sorting .= ' '; - - # Append fallback sorting - # Necessary to get a consistent sorting when multiple photos have same values - $sorting .= ', id DESC'; - # Execute query # Do not prepare $sorting because it is a true statement # Preparing (escaping) the sorting would destroy it @@ -241,12 +235,6 @@ class Settings extends Module { } - $sorting .= ' '; - - # Append fallback sorting - # Necessary to get a consistent sorting when multiple albums have same values - $sorting .= ', id DESC'; - # Execute query # Do not prepare $sorting because it is a true statement # Preparing (escaping) the sorting would destroy it From 212bb23eaa59148ec155b4e4d2dd943f805dbd0d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 29 Dec 2015 12:10:40 +0100 Subject: [PATCH 06/30] Fixed a typo --- docs/Installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Installation.md b/docs/Installation.md index 045b0fb..58d0175 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -25,7 +25,7 @@ You can also use the [direct download](https://github.com/electerious/Lychee/arc ### 3. Permissions -Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are reqiured. +Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are required. chmod -R 777 uploads/ data/ From 3c278ece9687c9903e667c5fea57da5854260c6f Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 29 Dec 2015 12:11:08 +0100 Subject: [PATCH 07/30] Moved LICENSE to separated file --- LICENSE | 21 +++++++++++++++++++++ README.md | 20 +------------------- 2 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9edea7a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Tobias Reich (http://electerious.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 9268148..f698d80 100644 --- a/README.md +++ b/README.md @@ -69,24 +69,6 @@ Here's a list of all available Plugins and Extensions: Take a look at the [FAQ](docs/FAQ.md) if you have problems. Discovered a bug? Please create an issue here on GitHub! -## Developer -| Version | Name | -|:-----------|:------------| -| 1.2, 1.3, 2.x, 3.x | [Tobias Reich](http://electerious.com)| -| 1.0, 1.1 | [Tobias Reich](http://electerious.com)
[Philipp Maurer](http://phinal.net) | - ## Donate -I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated. - -## License - -(MIT License) - -Copyright (C) 2015 [Tobias Reich](http://electerious.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated. \ No newline at end of file From 7f627a88c3fb6932e73b99c06e81b3ea45e90bc5 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 3 Jan 2016 12:50:12 +0100 Subject: [PATCH 08/30] (c) 2016 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9edea7a..6629516 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Tobias Reich (http://electerious.com/) +Copyright (c) 2016 Tobias Reich (http://electerious.com/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 23e78edc39e24cfaeb7243fe7ba8f2793312c6fd Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 4 Jan 2016 21:56:37 +0100 Subject: [PATCH 09/30] Replaced window.devicePixelRatio with srcset --- src/scripts/build.js | 8 ++++---- src/scripts/lychee.js | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/scripts/build.js b/src/scripts/build.js index 3e25391..2da005a 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -45,13 +45,13 @@ build.album = function(data) { let html = '' - let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbs[0]) + let { path: retinaThumbUrl, isPhoto } = lychee.retinize(data.thumbs[0]) html += lychee.html`
thumb thumb - thumb + thumb

$${ data.title }

$${ data.sysdate } @@ -82,11 +82,11 @@ build.photo = function(data) { let html = '' - let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbUrl) + let { path: retinaThumbUrl } = lychee.retinize(data.thumbUrl) html += lychee.html`
- thumb + thumb

$${ data.title }

` diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 018aeb0..0e8bd55 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -310,11 +310,10 @@ lychee.animate = function(obj, animation) { lychee.retinize = function(path = '') { - let pixelRatio = window.devicePixelRatio, - extention = path.split('.').pop(), - hasRetina = extention!=='svg' + let extention = path.split('.').pop(), + isPhoto = extention!=='svg' - if ((pixelRatio!=null && pixelRatio>1) && hasRetina===true) { + if (isPhoto===true) { path = path.replace(/\.[^/.]+$/, '') path = path + '@2x' + '.' + extention @@ -323,7 +322,7 @@ lychee.retinize = function(path = '') { return { path, - hasRetina + isPhoto } } From 14e808020aca3136a6bd028dffb5ec0c7729e15a Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 4 Jan 2016 21:56:52 +0100 Subject: [PATCH 10/30] Rebuild --- dist/main.js | 12 ++++++------ dist/view.js | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/main.js b/dist/main.js index f83908e..5260188 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,6 +1,6 @@ -function _taggedTemplateLiteral(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function gup(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t="[\\?&]"+e+"=([^&#]*)",n=new RegExp(t),o=n.exec(window.location.href);return null===o?"":o[1]}!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t="length"in e&&e.length,n=J.type(e);return"function"===n||J.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t,n){if(J.isFunction(t))return J.grep(e,function(e,o){return!!t.call(e,o,e)!==n});if(t.nodeType)return J.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(se.test(t))return J.filter(t,e,n);t=J.filter(t,e)}return J.grep(e,function(e){return X.call(t,e)>=0!==n})}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t=fe[e]={};return J.each(e.match(he)||[],function(e,n){t[n]=!0}),t}function r(){Z.removeEventListener("DOMContentLoaded",r,!1),e.removeEventListener("load",r,!1),J.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+s.uid++}function l(e,t,n){var o;if(void 0===n&&1===e.nodeType)if(o="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ye.test(n)?J.parseJSON(n):n}catch(i){}ve.set(e,t,n)}else n=void 0;return n}function c(){return!0}function u(){return!1}function d(){try{return Z.activeElement}catch(e){}}function p(e,t){return J.nodeName(e,"table")&&J.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function h(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function f(e){var t=Oe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n=0,o=e.length;o>n;n++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}function b(e,t){var n,o,i,a,r,s,l,c;if(1===t.nodeType){if(ge.hasData(e)&&(a=ge.access(e),r=ge.set(t,a),c=a.events)){delete r.handle,r.events={};for(i in c)for(n=0,o=c[i].length;o>n;n++)J.event.add(t,i,c[i][n])}ve.hasData(e)&&(s=ve.access(e),l=J.extend({},s),ve.set(t,l))}}function g(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&J.nodeName(e,t)?J.merge([e],n):n}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Te.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function y(t,n){var o,i=J(n.createElement(t)).appendTo(n.body),a=e.getDefaultComputedStyle&&(o=e.getDefaultComputedStyle(i[0]))?o.display:J.css(i[0],"display");return i.detach(),a}function w(e){var t=Z,n=Fe[e];return n||(n=y(e,t),"none"!==n&&n||(Re=(Re||J("