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.
50 lines
1.6 KiB
50 lines
1.6 KiB
package com.fr.plugin.web; |
|
|
|
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 GC1Component extends Component { |
|
public static final GC1Component KEY = new GC1Component(); |
|
/** |
|
* 返回需要引入的JS脚本路径 |
|
* @param client 请求客户端描述 |
|
* @return JS脚本路径 |
|
*/ |
|
public ScriptPath script( RequestClient client ) { |
|
if (PluginContexts.currentContext().isAvailable()) { |
|
// 做认证通过的事情 |
|
return ScriptPath.build("com/fr/plugin/web/js/GC1web.js"); |
|
} else { |
|
// 做认证未通过的事情 |
|
return ScriptPath.build("com/fr/plugin/web/js/webnuy.js"); |
|
} |
|
} |
|
|
|
/** |
|
* 返回需要引入的CSS样式路径 |
|
* @param client 请求客户端描述 |
|
* @return CSS样式路径 |
|
*/ |
|
public StylePath style( RequestClient client ) { |
|
//如果不需要就直接返回 StylePath.EMPTY; |
|
return StylePath.build("com/fr/plugin/web/css/GC1web.css"); |
|
} |
|
|
|
/** |
|
* 通过给定的资源过滤器控制是否加载这个资源 |
|
* @return 资源过滤器 |
|
*/ |
|
public Filter filter() { |
|
return new Filter(){ |
|
@Override |
|
public boolean accept() { |
|
//任何情况下我们都在平台组件加载时加载我们的组件 |
|
return true; |
|
} |
|
}; |
|
} |
|
}
|
|
|