js如何覆盖第三方脚本中的方法 js中怎么覆盖其他js的方法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第三方实例.prototype.fn = '重写的函数' <script type="text/javascript">// <![CDATA[// <![CDATA[//// LIBRARY REQUIREMENTS//// In the require function, we include the necessary libraries and modules for// the HTML dashboard. Then, we pass variable names for these libraries and// modules as function parameters, in order.//// When you add libraries or modules, remember to retain this mapping order// between the library or module and its function parameter. You can do this by// adding to the end of these lists, as shown in the commented examples below.require([ "splunkjs/mvc", "splunkjs/mvc/utils", "splunkjs/mvc/tokenutils", "underscore", "jquery", "splunkjs/mvc/simplexml", "splunkjs/mvc/layoutview", "splunkjs/mvc/simplexml/dashboardview", "splunkjs/mvc/simplexml/dashboard/panelref", "splunkjs/mvc/simplexml/element/chart", "splunkjs/mvc/simplexml/element/event", "splunkjs/mvc/simplexml/element/html", "splunkjs/mvc/simplexml/element/list", "splunkjs/mvc/simplexml/element/map", "splunkjs/mvc/simplexml/element/single", "splunkjs/mvc/simplexml/element/table", "splunkjs/mvc/simplexml/element/visualization", "splunkjs/mvc/simpleform/formutils", "splunkjs/mvc/simplexml/eventhandler", "splunkjs/mvc/simplexml/searcheventhandler", "splunkjs/mvc/simpleform/input/dropdown", "splunkjs/mvc/simpleform/input/radiogroup", "splunkjs/mvc/simpleform/input/linklist", "splunkjs/mvc/simpleform/input/multiselect", "splunkjs/mvc/simpleform/input/checkboxgroup", "splunkjs/mvc/simpleform/input/text", "splunkjs/mvc/simpleform/input/timerange", "splunkjs/mvc/simpleform/input/submit", "splunkjs/mvc/searchmanager", "splunkjs/mvc/savedsearchmanager", "splunkjs/mvc/postprocessmanager", "splunkjs/mvc/simplexml/urltokenmodel" // Add comma-separated libraries and modules manually here, for example: // ..."splunkjs/mvc/simplexml/urltokenmodel", // "splunkjs/mvc/tokenforwarder" ], function( mvc, utils, TokenUtils, _, $, DashboardController, LayoutView, Dashboard, PanelRef, ChartElement, EventElement, HtmlElement, ListElement, MapElement, SingleElement, TableElement, VisualizationElement, FormUtils, EventHandler, SearchEventHandler, DropdownInput, RadioGroupInput, LinkListInput, MultiSelectInput, CheckboxGroupInput, TextInput, TimeRangeInput, SubmitButton, SearchManager, SavedSearchManager, PostProcessManager, UrlTokenModel // Add comma-separated parameter names here, for example: // ...UrlTokenModel, // TokenForwarder ) { var pageLoading = true; // // TOKENS // // Create token namespaces var urlTokenModel = new UrlTokenModel(); mvc.Components.registerInstance('url', urlTokenModel); var defaultTokenModel = mvc.Components.getInstance('default', {create: true}); var submittedTokenModel = mvc.Components.getInstance('submitted', {create: true}); urlTokenModel.on('url:navigate', function() { defaultTokenModel.set(urlTokenModel.toJSON()); if (!_.isEmpty(urlTokenModel.toJSON()) && !_.all(urlTokenModel.toJSON(), _.isUndefined)) { submitTokens(); } else { submittedTokenModel.clear(); } }); // Initialize tokens defaultTokenModel.set(urlTokenModel.toJSON()); function submitTokens() { // Copy the contents of the defaultTokenModel to the submittedTokenModel and urlTokenModel FormUtils.submitForm({ replaceState: pageLoading }); } function setToken(name, value) { defaultTokenModel.set(name, value); submittedTokenModel.set(name, value); } function unsetToken(name) { defaultTokenModel.unset(name); submittedTokenModel.unset(name); } // // SEARCH MANAGERS // var search1 = new SearchManager({ "id": "search1", "status_buckets": 0, "sample_ratio": null, "earliest_time": "0", "cancelOnUnload": true, "search": "|makeresults|eval ip=\"$ips$\", address=\"$address$\",mask=\"$mask$\",mask_num=\"$masknum$\" | table ip address mask mask_num", "latest_time": "$latest$", "app": utils.getCurrentApp(), "auto_cancel": 90, "preview": true, "tokenDependencies": { }, "runWhenTimeIsUndefined": false }, {tokens: true, tokenNamespace: "submitted"}); // // SPLUNK LAYOUT // $('header').remove(); new LayoutView({"hideChrome": false, "hideAppBar": false, "hideSplunkBar": false}) .render() .getContainerElement() .appendChild($('.dashboard-body')[0]); // // DASHBOARD EDITOR // new Dashboard({ id: 'dashboard', el: $('.dashboard-body'), showTitle: true, editable: true }, {tokens: true}).render(); // // VIEWS: VISUALIZATION ELEMENTS // var element1 = new TableElement({ "id": "element1", "count": 10, "dataOverlayMode": "none", "drilldown": "cell", "refresh.display": "progressbar", "rowNumbers": "true", "wrap": "true", "managerid": "search1", "el": $('#element1') }, {tokens: true, tokenNamespace: "submitted"}).render(); // // VIEWS: FORM INPUTS // var input1 = new TextInput({ "id": "input1", "default": "", "value": "$form.ips$", "el": $('#input1') }, {tokens: true}).render(); input1.on("change", function(newValue) { FormUtils.handleValueChange(input1); }); var input2 = new TextInput({ "id": "input2", "value": "$form.address$", "el": $('#input2') }, {tokens: true}).render(); input2.on("change", function(newValue) { FormUtils.handleValueChange(input2); }); var input3 = new DropdownInput({ "id": "input3", "choices": [ {"label": "\u7537", "value": "\u7537"}, {"label": "\u5973", "value": "\u5973"} ], "showClearButton": true, "selectFirstChoice": false, "value": "$form.mask$", "el": $('#input3') }, {tokens: true}).render(); input3.on("change", function(newValue) { FormUtils.handleValueChange(input3); }); var input4 = new TextInput({ "id": "input4", "value": "$form.masknum$", "el": $('#input4') }, {tokens: true}).render(); input4.on("change", function(newValue) { FormUtils.handleValueChange(input4); }); // // SUBMIT FORM DATA // var submit = new SubmitButton({ id: 'submit', el: $('#search_btn') }, {tokens: true}).render(); submit.on("submit", function() { submitTokens(); }); // Initialize time tokens to default if (!defaultTokenModel.has('earliest') && !defaultTokenModel.has('latest')) { defaultTokenModel.set({ earliest: '0', latest: '' }); } if (!_.isEmpty(urlTokenModel.toJSON())){ submitTokens(); } // // DASHBOARD READY // DashboardController.ready(); pageLoading = false; });// ]]></script>这个里面的内容不能修改,怎么才能把它替换掉,或者清除掉,换用自己的 不同的framework可能会有不同的override方式。你最好查看相应的api。 开发大型网站如何架构 请教一个小问题: 请教关于hidde项目的容量限制 关于一段轮播的代码,我写的太死板的 请教季度问题 大神求救正则表达式 100分急求一个小东西的源码 赶紧来挣分!!! 怎么判断浏览器的版本是 IE 6 及以上? 怎么得到当前元素最近的前一个元素?例如<span><span id=21>21</span><p></p><span id=22>22</span></span>,如果当前元素为22,怎么得到 如何利用js判断textarea中的字符数,如果大于一个特定的数值,就弹出窗口报错? Ext js环境搭建与项目搭建, JS库初学求答案
// <![CDATA[
// <![CDATA[
//
// LIBRARY REQUIREMENTS
//
// In the require function, we include the necessary libraries and modules for
// the HTML dashboard. Then, we pass variable names for these libraries and
// modules as function parameters, in order.
//
// When you add libraries or modules, remember to retain this mapping order
// between the library or module and its function parameter. You can do this by
// adding to the end of these lists, as shown in the commented examples below.require([
"splunkjs/mvc",
"splunkjs/mvc/utils",
"splunkjs/mvc/tokenutils",
"underscore",
"jquery",
"splunkjs/mvc/simplexml",
"splunkjs/mvc/layoutview",
"splunkjs/mvc/simplexml/dashboardview",
"splunkjs/mvc/simplexml/dashboard/panelref",
"splunkjs/mvc/simplexml/element/chart",
"splunkjs/mvc/simplexml/element/event",
"splunkjs/mvc/simplexml/element/html",
"splunkjs/mvc/simplexml/element/list",
"splunkjs/mvc/simplexml/element/map",
"splunkjs/mvc/simplexml/element/single",
"splunkjs/mvc/simplexml/element/table",
"splunkjs/mvc/simplexml/element/visualization",
"splunkjs/mvc/simpleform/formutils",
"splunkjs/mvc/simplexml/eventhandler",
"splunkjs/mvc/simplexml/searcheventhandler",
"splunkjs/mvc/simpleform/input/dropdown",
"splunkjs/mvc/simpleform/input/radiogroup",
"splunkjs/mvc/simpleform/input/linklist",
"splunkjs/mvc/simpleform/input/multiselect",
"splunkjs/mvc/simpleform/input/checkboxgroup",
"splunkjs/mvc/simpleform/input/text",
"splunkjs/mvc/simpleform/input/timerange",
"splunkjs/mvc/simpleform/input/submit",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/savedsearchmanager",
"splunkjs/mvc/postprocessmanager",
"splunkjs/mvc/simplexml/urltokenmodel"
// Add comma-separated libraries and modules manually here, for example:
// ..."splunkjs/mvc/simplexml/urltokenmodel",
// "splunkjs/mvc/tokenforwarder"
],
function(
mvc,
utils,
TokenUtils,
_,
$,
DashboardController,
LayoutView,
Dashboard,
PanelRef,
ChartElement,
EventElement,
HtmlElement,
ListElement,
MapElement,
SingleElement,
TableElement,
VisualizationElement,
FormUtils,
EventHandler,
SearchEventHandler,
DropdownInput,
RadioGroupInput,
LinkListInput,
MultiSelectInput,
CheckboxGroupInput,
TextInput,
TimeRangeInput,
SubmitButton,
SearchManager,
SavedSearchManager,
PostProcessManager,
UrlTokenModel // Add comma-separated parameter names here, for example:
// ...UrlTokenModel,
// TokenForwarder
) { var pageLoading = true;
//
// TOKENS
// // Create token namespaces
var urlTokenModel = new UrlTokenModel();
mvc.Components.registerInstance('url', urlTokenModel);
var defaultTokenModel = mvc.Components.getInstance('default', {create: true});
var submittedTokenModel = mvc.Components.getInstance('submitted', {create: true}); urlTokenModel.on('url:navigate', function() {
defaultTokenModel.set(urlTokenModel.toJSON());
if (!_.isEmpty(urlTokenModel.toJSON()) && !_.all(urlTokenModel.toJSON(), _.isUndefined)) {
submitTokens();
} else {
submittedTokenModel.clear();
}
}); // Initialize tokens
defaultTokenModel.set(urlTokenModel.toJSON()); function submitTokens() {
// Copy the contents of the defaultTokenModel to the submittedTokenModel and urlTokenModel
FormUtils.submitForm({ replaceState: pageLoading });
} function setToken(name, value) {
defaultTokenModel.set(name, value);
submittedTokenModel.set(name, value);
} function unsetToken(name) {
defaultTokenModel.unset(name);
submittedTokenModel.unset(name);
} //
// SEARCH MANAGERS
//
var search1 = new SearchManager({
"id": "search1",
"status_buckets": 0,
"sample_ratio": null,
"earliest_time": "0",
"cancelOnUnload": true,
"search": "|makeresults|eval ip=\"$ips$\", address=\"$address$\",mask=\"$mask$\",mask_num=\"$masknum$\" | table ip address mask mask_num",
"latest_time": "$latest$",
"app": utils.getCurrentApp(),
"auto_cancel": 90,
"preview": true,
"tokenDependencies": {
},
"runWhenTimeIsUndefined": false
}, {tokens: true, tokenNamespace: "submitted"});
//
// SPLUNK LAYOUT
// $('header').remove();
new LayoutView({"hideChrome": false, "hideAppBar": false, "hideSplunkBar": false})
.render()
.getContainerElement()
.appendChild($('.dashboard-body')[0]); //
// DASHBOARD EDITOR
// new Dashboard({
id: 'dashboard',
el: $('.dashboard-body'),
showTitle: true,
editable: true
}, {tokens: true}).render();
//
// VIEWS: VISUALIZATION ELEMENTS
// var element1 = new TableElement({
"id": "element1",
"count": 10,
"dataOverlayMode": "none",
"drilldown": "cell",
"refresh.display": "progressbar",
"rowNumbers": "true",
"wrap": "true",
"managerid": "search1",
"el": $('#element1')
}, {tokens: true, tokenNamespace: "submitted"}).render();
//
// VIEWS: FORM INPUTS
// var input1 = new TextInput({
"id": "input1",
"default": "",
"value": "$form.ips$",
"el": $('#input1')
}, {tokens: true}).render(); input1.on("change", function(newValue) {
FormUtils.handleValueChange(input1);
});
var input2 = new TextInput({
"id": "input2",
"value": "$form.address$",
"el": $('#input2')
}, {tokens: true}).render(); input2.on("change", function(newValue) {
FormUtils.handleValueChange(input2);
});
var input3 = new DropdownInput({
"id": "input3",
"choices": [
{"label": "\u7537", "value": "\u7537"},
{"label": "\u5973", "value": "\u5973"}
],
"showClearButton": true,
"selectFirstChoice": false,
"value": "$form.mask$",
"el": $('#input3')
}, {tokens: true}).render(); input3.on("change", function(newValue) {
FormUtils.handleValueChange(input3);
});
var input4 = new TextInput({
"id": "input4",
"value": "$form.masknum$",
"el": $('#input4')
}, {tokens: true}).render(); input4.on("change", function(newValue) {
FormUtils.handleValueChange(input4);
});
//
// SUBMIT FORM DATA
// var submit = new SubmitButton({
id: 'submit',
el: $('#search_btn')
}, {tokens: true}).render(); submit.on("submit", function() {
submitTokens();
}); // Initialize time tokens to default
if (!defaultTokenModel.has('earliest') && !defaultTokenModel.has('latest')) {
defaultTokenModel.set({ earliest: '0', latest: '' });
} if (!_.isEmpty(urlTokenModel.toJSON())){
submitTokens();
}
//
// DASHBOARD READY
// DashboardController.ready();
pageLoading = false; }
);
// ]]>
</script>
这个里面的内容不能修改,怎么才能把它替换掉,或者清除掉,换用自己的
你最好查看相应的api。