You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.5 KiB
43 lines
1.5 KiB
3 years ago
|
package com.fr.plugin.theme.topMenu.bean;
|
||
|
|
||
|
import com.fr.decision.config.AppearanceConfig;
|
||
|
import com.fr.plugin.context.PluginContexts;
|
||
|
import com.fr.web.struct.Component;
|
||
|
import com.fr.web.struct.Filter;
|
||
|
import com.fr.web.struct.browser.RequestClient;
|
||
|
import com.fr.web.struct.category.ScriptPath;
|
||
|
import com.fr.web.struct.category.StylePath;
|
||
|
|
||
|
public class ThemeAtom extends Component {
|
||
|
public static final ThemeAtom KEY=new ThemeAtom();
|
||
|
@Override
|
||
|
public ScriptPath script(RequestClient requestClient) {
|
||
|
if (PluginContexts.currentContext().isAvailable()) {
|
||
|
return ScriptPath.build("/com/fr/plugin/theme/topMenu/js/navigation.theme.js");
|
||
|
} else {
|
||
|
return ScriptPath.EMPTY;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public StylePath style(RequestClient requestClient) {
|
||
|
if (PluginContexts.currentContext().isAvailable()) {
|
||
|
return StylePath.build("/com/fr/plugin/theme/topMenu/js/navigation.theme.css");
|
||
|
} else {
|
||
|
return StylePath.EMPTY;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Filter filter() {
|
||
|
return new Filter() {
|
||
|
@Override
|
||
|
public boolean accept() {
|
||
|
System.out.println(AppearanceConfig.getInstance().getThemeId());
|
||
|
/*这边添加有一个过滤条件,只有切换使用了当前主题才引入这些js*/
|
||
|
return "com.eco.plugin.xxxx.theme.topMenu".equals(AppearanceConfig.getInstance().getThemeId());
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|