Skip to content

Commit

Permalink
extensions: Add PlaceholdersExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed May 6, 2024
1 parent a68f8ab commit bc8c35e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2022,2023 Christian Kohlschütter
* Copyright 2014,2015 Evernote Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kohlschutter.dumbo.placeholders;

import com.kohlschutter.dumbo.annotations.CSSResource;
import com.kohlschutter.dumbo.annotations.JavaScriptResource;
import com.kohlschutter.dumbo.api.DumboComponent;

/**
* Improves handling of placeholder resources
*/
@CSSResource(value = "css/placeholders.css", group = "dumbo")
@JavaScriptResource(value = "js/placeholders.js", group = "dumbo", async = true)
public interface PlaceholdersExtension extends DumboComponent {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BODY:not([class*=dumbo-ready]) .dumbo-placeholder {
opacity: 0;
}

BODY[class*=dumbo-ready]:not([class*=static-design-mode]) .dumbo-placeholder {
transition: opacity 0.33s ease-in;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Dumbo.whenReady(function() {
setTimeout(() => document.body.classList.add("dumbo-ready"), 0);
});
Dumbo.whenStatic(function() {
document.body.classList.add("dumbo-ready");
});

0 comments on commit bc8c35e

Please sign in to comment.