Merge branch 'no-modernizr'
This commit is contained in:
commit
9c4138399d
5 changed files with 30 additions and 22 deletions
|
@ -432,7 +432,6 @@ class BasePage
|
|||
"vendor/bower-asset/jquery/dist/jquery.min.js",
|
||||
"vendor/bower-asset/jquery-timeago/jquery.timeago.js",
|
||||
"vendor/bower-asset/js-cookie/src/js.cookie.js",
|
||||
"ext/static_files/modernizr-3.3.1.custom.js",
|
||||
],
|
||||
zglob("ext/{" . Extension::get_enabled_extensions_as_string() . "}/script.js"),
|
||||
zglob("themes/$theme_name/{" . implode(",", $this->get_theme_scripts()) . "}")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,14 +6,27 @@ function joinUrlSegments(base, query) {
|
|||
return base + separatorChar + query;
|
||||
}
|
||||
|
||||
function clearViewMode() {
|
||||
document.querySelectorAll('.image_info').forEach((element) => {
|
||||
element.classList.remove('infomode-view');
|
||||
});
|
||||
}
|
||||
|
||||
function updateAttr(selector, attr, value) {
|
||||
document.querySelectorAll(selector).forEach(function(e) {
|
||||
let current = e.getAttribute(attr);
|
||||
let newval = joinUrlSegments(current, query);
|
||||
e.setAttribute(attr, newval);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
function updateAttr(selector, attr, value) {
|
||||
document.querySelectorAll(selector).forEach(function(e) {
|
||||
let current = e.getAttribute(attr);
|
||||
let newval = joinUrlSegments(current, query);
|
||||
e.setAttribute(attr, newval);
|
||||
});
|
||||
}
|
||||
// find elements with class image_info and set them to view mode
|
||||
// (by default, with no js, they are in edit mode - so that no-js
|
||||
// users can still edit them)
|
||||
document.querySelectorAll('.image_info').forEach((element) => {
|
||||
element.classList.add('infomode-view');
|
||||
});
|
||||
|
||||
if(document.location.hash.length > 3) {
|
||||
var query = document.location.hash.substring(1);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
|
||||
.js .image_info .edit {
|
||||
display: none;
|
||||
}
|
||||
.js .image_info .view {
|
||||
.image_info .edit {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.no-js .image_info .edit {
|
||||
display: block;
|
||||
}
|
||||
.no-js .image_info .view {
|
||||
.image_info .view {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.image_info.infomode-view .edit {
|
||||
display: none;
|
||||
}
|
||||
.image_info.infomode-view .view {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class ViewImageTheme extends Themelet
|
|||
) {
|
||||
$html .= "
|
||||
<tr><td colspan='4'>
|
||||
<input class='view' type='button' value='Edit' onclick='$(\".view\").hide(); $(\".edit\").show();'>
|
||||
<input class='view' type='button' value='Edit' onclick='clearViewMode()'>
|
||||
<input class='edit' type='submit' value='Set'>
|
||||
</td></tr>
|
||||
";
|
||||
|
|
Reference in a new issue