sp-jsom-node
Version:
SharePoint JavaScript Object Model for Node.js
1,401 lines (1,184 loc) • 372 kB
JavaScript
//***********IMPORTANT!!!! READ THIS!!!!!!***********************************
//Don't add script in this file! Only function alias is allowed in this file!
//***************************************************************************
Type.registerNamespace('Srch');
Srch.EventType = function() {}
Srch.EventType.prototype = {
none: 0,
queryReady: 1,
queryIssuing: 2,
batchQueryIssuing: 3,
resultReady: 4,
batchResultReady: 5,
queryStateChanged: 6,
resultRendered: 7,
preLoad: 8,
load: 9,
postLoad: 10
}
Srch.EventType.registerEnum('Srch.EventType', false);
Srch.MessageLevel = function() {}
Srch.MessageLevel.prototype = {
information: 0,
warning: 1,
error: 2
}
Srch.MessageLevel.registerEnum('Srch.MessageLevel', false);
Srch.UserActionType = function() {}
Srch.UserActionType.prototype = {
search: 0,
pageNext: 1,
pagePrev: 2,
refine: 3,
sort: 4,
filterLanguage: 5
}
Srch.UserActionType.registerEnum('Srch.UserActionType', false);
Srch.DateTimeKind = function() {}
Srch.DateTimeKind.prototype = {
unspecified: 0,
utc: 1,
local: 2
}
Srch.DateTimeKind.registerEnum('Srch.DateTimeKind', false);
Srch.ClientControl = function Srch_ClientControl(elem) {
this.$$d_serverTemplateScriptsCallback = Function.createDelegate(this, this.serverTemplateScriptsCallback);
this.$$d_clickHandler = Function.createDelegate(this, this.clickHandler);
this.$$d_scriptApplication_PostLoad = Function.createDelegate(this, this.scriptApplication_PostLoad);
this.$$d_scriptApplication_Load = Function.createDelegate(this, this.scriptApplication_Load);
this.$$d_scriptApplication_PreLoad = Function.createDelegate(this, this.scriptApplication_PreLoad);
this.listenedEvents = [];
this.serverTemplateScriptsToLoad = [];
this.$e_2 = [];
this.$1L_2 = [];
Srch.ClientControl.initializeBase(this, [ elem ]);
}
Srch.ClientControl.get_isLoadingSearchCenterUrl = function Srch_ClientControl$get_isLoadingSearchCenterUrl$st() {
return Srch.ClientControl.$s;
}
Srch.ClientControl.set_isLoadingSearchCenterUrl = function Srch_ClientControl$set_isLoadingSearchCenterUrl$st(value) {
Srch.ClientControl.$s = value;
return value;
}
Srch.ClientControl.toggleMessageDetails = function Srch_ClientControl$toggleMessageDetails$st(messageContainer) {
var $v_0 = messageContainer.children;
if (Srch.U.n($v_0)) {
return false;
}
for (var $v_1 = 0; $v_1 < $v_0.length; $v_1++) {
var $v_2 = $v_0[$v_1];
if ($v_2.style.display === 'none') {
$v_2.style.display = '';
}
else {
$v_2.style.display = 'none';
}
}
return false;
}
Srch.ClientControl.$3P = function Srch_ClientControl$$3P$st($p0) {
return $p0.showForViewerUsers;
}
Srch.ClientControl.prototype = {
alternateRenderer: null,
alternateRenderContext: null,
$1I_2: null,
$19_2: null,
$1H_2: null,
loaded: false,
get_nextUniqueId: function Srch_ClientControl$get_nextUniqueId$in() {
this.$3R_2++;
return this.get_id() + this.$3R_2;
},
$3R_2: 0,
get_renderTemplateId: function Srch_ClientControl$get_renderTemplateId$in() {
return this.$26_2;
},
set_renderTemplateId: function Srch_ClientControl$set_renderTemplateId$in(value) {
this.$26_2 = value;
return value;
},
$26_2: '',
get_delayLoadTemplateScripts: function Srch_ClientControl$get_delayLoadTemplateScripts$in() {
return this.$12_2;
},
set_delayLoadTemplateScripts: function Srch_ClientControl$set_delayLoadTemplateScripts$in(value) {
this.$12_2 = value;
return value;
},
$12_2: true,
get_states: function Srch_ClientControl$get_states$in() {
if (!this.$2E_2) {
this.$2E_2 = {};
}
return this.$2E_2;
},
set_states: function Srch_ClientControl$set_states$in(value) {
this.$2E_2 = value;
return value;
},
$2E_2: null,
get_messages: function Srch_ClientControl$get_messages$in() {
return this.$7_2;
},
set_messages: function Srch_ClientControl$set_messages$in(value) {
if (!Srch.U.n(value) && value.length > 0) {
this.$7_2 = [];
for (var $v_0 = 0; $v_0 < value.length; $v_0++) {
var $v_1 = value[$v_0];
if (!Srch.U.n($v_1)) {
Srch.U.appendArray(this.$7_2, Srch.ControlMessage.getIfControlMessage($v_1));
}
}
}
else {
this.$7_2 = value;
}
return value;
},
$7_2: null,
get_showDataErrors: function Srch_ClientControl$get_showDataErrors$in() {
return this.$2z_2;
},
set_showDataErrors: function Srch_ClientControl$set_showDataErrors$in(value) {
this.$2z_2 = value;
return value;
},
$2z_2: false,
get_alternateErrorMessage: function Srch_ClientControl$get_alternateErrorMessage$in() {
return this.$v_2;
},
set_alternateErrorMessage: function Srch_ClientControl$set_alternateErrorMessage$in(value) {
this.$v_2 = value;
return value;
},
$v_2: null,
get_isInitialLoad: function Srch_ClientControl$get_isInitialLoad$in() {
return !this.loaded;
},
$3p_2: false,
$2L_2: null,
get_resultsPageAddress: function Srch_ClientControl$get_resultsPageAddress$in() {
return this.$2L_2;
},
set_resultsPageAddress: function Srch_ClientControl$set_resultsPageAddress$in(value) {
this.$2L_2 = value;
return value;
},
initialize: function Srch_ClientControl$initialize$in() {
this.$1_2('Initialize', '');
Srch.ScriptApplicationManager.get_current().registerClientControl(this);
this.$1I_2 = this.$$d_scriptApplication_PreLoad;
Srch.ScriptApplicationManager.get_current().add_preLoad(this.$1I_2);
this.$19_2 = this.$$d_scriptApplication_Load;
Srch.ScriptApplicationManager.get_current().add_load(this.$19_2);
this.$1H_2 = this.$$d_scriptApplication_PostLoad;
Srch.ScriptApplicationManager.get_current().add_postLoad(this.$1H_2);
if (!Srch.U.n(this.get_element())) {
$addHandler(this.get_element(), 'click', this.$$d_clickHandler);
}
if (!Srch.ClientControl.$s) {
Srch.ClientControl.$s = true;
Srch.U.getSearchCenterUrl(true);
}
if (this.$3p_2) {
this.$5K_2();
}
Sys.Component.prototype.initialize.call(this);
},
$5K_2: function Srch_ClientControl$$5K_2$in() {
var $v_0 = SP.PageContextInfo.get_siteServerRelativeUrl();
var $v_1 = '/_api/search/resultspageaddress';
var $v_2 = ($v_0 && $v_0 !== '/') ? $v_0 + $v_1 : $v_1;
var $v_3 = new XMLHttpRequest();
$v_3.open('GET', $v_2, true);
$v_3.setRequestHeader('Accept', 'application/json;odata=verbose');
var $$t_7 = this;
$v_3.onreadystatechange = function() {
if ($v_3.readyState === 4) {
if ($v_3.status === 200) {
var $v_4 = Sys.Serialization.JavaScriptSerializer.deserialize($v_3.responseText);
var $v_5 = $v_4['d'];
if (Srch.U.n($v_5)) {
Srch.U.trace(null, 'GetResultsPageAddress', 'No data recieved from _api/search/resultspageaddress');
}
var $v_6 = $v_5['resultspageaddress'];
if (!Srch.U.w($v_6)) {
$$t_7.$2L_2 = $v_6;
}
}
}
};
$v_3.send(null);
},
dispose: function Srch_ClientControl$dispose$in() {
var $v_0 = new SP.CScope('ClientControl.Dispose');
$v_0.start();
this.$1_2('Dispose', '');
try {
if (!Srch.U.n(this.get_element())) {
$clearHandlers(this.get_element());
}
if (!Srch.U.n(this.listenedEvents)) {
for (var $v_1 = 0; $v_1 < this.listenedEvents.length; $v_1++) {
var $v_2 = this.listenedEvents[$v_1];
if (!Srch.U.n($v_2)) {
$v_2.dispose();
}
}
this.listenedEvents = null;
}
if (!Srch.U.n(this.$1I_2)) {
Srch.ScriptApplicationManager.get_current().remove_preLoad(this.$1I_2);
this.$1I_2 = null;
}
if (!Srch.U.n(this.$19_2)) {
Srch.ScriptApplicationManager.get_current().remove_load(this.$19_2);
this.$19_2 = null;
}
if (!Srch.U.n(this.$1H_2)) {
Srch.ScriptApplicationManager.get_current().remove_postLoad(this.$1H_2);
this.$1H_2 = null;
}
}
finally {
Sys.Component.prototype.dispose.call(this);
}
$v_0.stop();
},
renderControl: function Srch_ClientControl$renderControl$in(listData, dp) {
this.$1_2('RenderControl', '');
var $v_0 = new SP.CScope('ClientControl.RenderControl');
$v_0.start();
Srch.U.ensureNotNullOrUndefined(this.get_element(), this, 'RenderControl', 'this.Element');
if (Srch.U.n(this.alternateRenderContext)) {
this.alternateRenderContext = {};
}
var $v_1 = {};
if (!Srch.U.n(this.alternateRenderer)) {
$v_1 = this.alternateRenderContext;
this.alternateRenderContext['ListData'] = listData;
this.alternateRenderContext['ClientControl'] = this;
this.alternateRenderContext['DataProvider'] = dp;
this.alternateRenderContext['ScriptApplicationManager'] = Srch.ScriptApplicationManager.get_current();
this.invokeAlternateRender(this.alternateRenderer, this.get_element(), this.alternateRenderContext);
}
else {
$v_1['ResolveTemplate'] = Srch.U.resolveRenderTemplate;
$v_1['ListData'] = listData;
$v_1['ClientControl'] = this;
$v_1['DataProvider'] = dp;
$v_1['ScriptApplicationManager'] = Srch.ScriptApplicationManager.get_current();
this.invokeClientRenderer(this.get_element(), $v_1);
}
this.processDataProviderErrors(dp);
this.processRenderingErrorMessages($v_1);
this.displayControlMessages();
$v_0.stop();
},
processDataProviderErrors: function Srch_ClientControl$processDataProviderErrors$in(dataProviderToProcess) {
if (!Srch.U.n(dataProviderToProcess) && !Srch.U.n(dataProviderToProcess.$7_2) && dataProviderToProcess.$7_2.length > 0) {
this.processDataErrorMessages(dataProviderToProcess.$7_2);
}
},
scriptApplication_PreLoad: function Srch_ClientControl$scriptApplication_PreLoad$in(sender, e) {
this.$1_2('ScriptApplication_PreLoad', 'ClientControl');
if (this.$12_2) {
Srch.U.appendScriptsToLoad(this.serverTemplateScriptsToLoad, this.$26_2);
}
},
scriptApplication_Load: function Srch_ClientControl$scriptApplication_Load$in(sender, e) {
this.$1_2('ScriptApplication_Load', 'ClientControl');
},
scriptApplication_PostLoad: function Srch_ClientControl$scriptApplication_PostLoad$in(sender, e) {
this.$1_2('ScriptApplication_PostLoad', 'ClientControl');
this.loaded = true;
},
loadServerTemplateScripts: function Srch_ClientControl$loadServerTemplateScripts$in() {
this.$1_2('LoadServerTemplateScripts', 'Trying to load server template scripts...');
return this.loadRenderTemplateScripts(this.serverTemplateScriptsToLoad, this.$$d_serverTemplateScriptsCallback, this.$$d_serverTemplateScriptsCallback, -1, false);
},
serverTemplateScriptsCallback: function Srch_ClientControl$serverTemplateScriptsCallback$in() {
this.$1_2('ServerTemplateScriptsCallback', 'ServerTemplateScriptsCallback');
this.serverTemplateScriptsToLoad = [];
},
loadRenderTemplateScripts: function Srch_ClientControl$loadRenderTemplateScripts$in(scriptReferences, success, failure, timeout, loadStandAloneCustomScripts) {
this.$1_2('LoadRenderTemplateScripts', 'Loading render template scripts...');
var $$t_7 = this, $$t_8 = this;
if (Srch.U.loadScripts(scriptReferences, function($p1_0) {
$$t_7.$5p_2($p1_0, success, failure, timeout);
}, function($p1_0) {
$$t_8.$5o_2($p1_0, failure);
}, timeout)) {
return true;
}
this.$1_2('LoadRenderTemplateScripts', 'Did not discover new render template script to load.');
if (loadStandAloneCustomScripts) {
return this.$4I_2(success, failure, timeout);
}
else {
this.$1_2('LoadRenderTemplateScripts', 'Skip loading custom scripts.');
return false;
}
},
$5p_2: function Srch_ClientControl$$5p_2$in($p0, $p1, $p2, $p3) {
this.$1_2('RenderTemplateScriptsLoaded', 'All render template scripts loaded.');
Srch.U.registerLoadedScripts($p0);
if (this.$4I_2($p1, $p2, $p3)) {
return;
}
$p1();
},
$5o_2: function Srch_ClientControl$$5o_2$in($p0, $p1) {
this.$1_2('RenderTemplateScriptsFailed', 'Loading render template scripts faild.');
this.$4Q_2($p0);
$p1();
},
$4I_2: function Srch_ClientControl$$4I_2$in($p0, $p1, $p2) {
this.$1_2('LoadCustomScripts', 'Loading custom scripts...');
if (!Srch.U.n(Srch.ScriptApplicationManager.get_current().$1Z_1)) {
var $v_0 = [];
var $$dict_7 = Srch.ScriptApplicationManager.get_current().$1Z_1;
for (var $$key_8 in $$dict_7) {
var $v_1 = { key: $$key_8, value: $$dict_7[$$key_8] };
var $v_2 = $v_1.key;
if (!Srch.U.e($v_2)) {
var $v_3 = $v_2.trim().toLowerCase();
if ($v_3.endsWith('.css')) {
$v_3 = Srch.U.urlTokenExpansion($v_3);
Srch.U.traceFormatted(null, 'LoadCustomScripts', 'Found custom css:\'{0}\'', $v_3);
if (Srch.U.n(Srch.ScriptApplicationManager.get_current().$1A_1[$v_3])) {
registerCssLink($v_3);
Srch.U.traceFormatted(null, 'LoadCustomScripts', 'Registering css \'{0}\' as loaded', $v_3);
Srch.ScriptApplicationManager.get_current().$1A_1[$v_3] = false;
}
}
else {
Srch.U.appendScriptsToLoad($v_0, $v_2);
}
}
}
var $$t_B = this, $$t_C = this;
if (Srch.U.loadScripts($v_0, function($p1_0) {
$$t_B.$56_2($p1_0, $p0);
}, function($p1_0) {
$$t_C.$55_2($p1_0, $p1);
}, $p2)) {
return true;
}
}
this.$1_2('LoadCustomScripts', 'Did not discover new custom script to load.');
return false;
},
$56_2: function Srch_ClientControl$$56_2$in($p0, $p1) {
this.$1_2('CustomScriptsLoaded', 'All custom scripts loaded.');
Srch.U.registerLoadedScripts($p0);
$p1();
},
$55_2: function Srch_ClientControl$$55_2$in($p0, $p1) {
this.$1_2('CustomScriptsFailed', 'Loading custom scripts failed.');
var $v_0 = this.$4Q_2($p0);
var $v_1 = String.format(SP.Utilities.HttpUtility.htmlEncode(Srch.Res.u_ScriptLoadFail), $v_0);
var $v_2 = SP.Utilities.HttpUtility.htmlEncode(Srch.Res.u_ScriptLoadFailForViewer);
var $v_3 = new Srch.ControlMessage(null, 2, 0, 'ResourceLoadException', $v_1, $v_2, null, null, false, true, false);
Srch.U.appendArray(this.$7_2, $v_3);
$p1();
},
$4Q_2: function Srch_ClientControl$$4Q_2$in($p0) {
var $v_0 = '<ul>';
if (!Srch.U.n($p0)) {
for (var $v_1 = 0; $v_1 < $p0.length; $v_1++) {
var $v_2 = $p0[$v_1];
if (!Srch.U.w($v_2)) {
this.$3_2('ProcessLoadFailedScripts', 'Loading script \'{0}\' failed.', $v_2);
$v_0 += '<li>' + SP.Utilities.HttpUtility.htmlEncode($v_2) + '</li>';
}
}
}
$v_0 += '</ul>';
return $v_0;
},
invokeAlternateRender: function Srch_ClientControl$invokeAlternateRender$in(callback, container, ctx) {
var $v_0 = new SP.CScope('ClientControl.InvokeAlternateRender');
$v_0.start();
if (!Srch.U.n(callback)) {
callback(container, ctx);
}
$v_0.stop();
},
invokeClientRenderer: function Srch_ClientControl$invokeClientRenderer$in(node, ctx) {
var $v_0 = new SP.CScope('ClientControl.InvokeClientRenderer');
$v_0.start();
SPClientRenderer.Render(node, ctx);
$v_0.stop();
},
$M_2: null,
$5B_2: function Srch_ClientControl$$5B_2$in() {
if (Srch.U.n(this.$M_2) && !Srch.U.n(this.get_element())) {
this.$M_2 = document.createElement('div');
this.$M_2.style.display = 'none';
var $v_0 = this.get_element().parentNode;
$v_0.insertBefore(this.$M_2, this.get_element());
}
},
processDataErrorMessages: function Srch_ClientControl$processDataErrorMessages$in(dataErrorsList) {
if (!Srch.U.n(dataErrorsList) && Srch.U.isArray(dataErrorsList)) {
for (var $$arr_1 = dataErrorsList, $$len_2 = $$arr_1.length, $$idx_3 = 0; $$idx_3 < $$len_2; ++$$idx_3) {
var $v_0 = $$arr_1[$$idx_3];
Srch.U.appendArray(this.$e_2, $v_0);
}
}
},
processRenderingErrorMessages: function Srch_ClientControl$processRenderingErrorMessages$in(ctx) {
var $v_0 = ctx['Errors'];
if (!Srch.U.n($v_0) && Srch.U.isArray($v_0)) {
for (var $$arr_2 = $v_0, $$len_3 = $$arr_2.length, $$idx_4 = 0; $$idx_4 < $$len_3; ++$$idx_4) {
var $v_1 = $$arr_2[$$idx_4];
Srch.U.appendArray(this.$1L_2, Srch.ControlMessage.getFromException($v_1));
}
ctx['Errors'] = null;
}
},
hasMessages: function Srch_ClientControl$hasMessages$in() {
var $v_0 = Srch.U.$3J();
return (!!this.$7_2 && this.$7_2.length > 0) || (!!this.$e_2 && this.$e_2.length > 0) || (!!this.$1L_2 && this.$1L_2.length > 0) || (!!$v_0 && $v_0.length > 0);
},
updateDisplayControlWithNewMessages: function Srch_ClientControl$updateDisplayControlWithNewMessages$in() {
this.$3z_2(true);
},
displayControlMessages: function Srch_ClientControl$displayControlMessages$in() {
this.$3z_2(false);
},
$3z_2: function Srch_ClientControl$$3z_2$in($p0) {
var $v_0 = this.$5D_2(this.$7_2, this.$e_2, this.$1L_2, Srch.U.$3J(), $p0);
if (!Srch.U.w($v_0) || !$p0) {
var $v_1 = this.$W_2.length > 0 || this.$a_2.length > 0 || this.$e_2.length > 0;
this.$5B_2();
if (!Srch.U.w($v_0)) {
this.$M_2.innerHTML = $v_0;
this.$M_2.style.display = '';
}
else {
this.$M_2.innerHTML = '';
this.$M_2.style.display = 'none';
}
this.setControlElementVisibility(!$v_1);
}
this.$e_2 = [];
this.$1L_2 = [];
Srch.U.$5r();
},
setControlElementVisibility: function Srch_ClientControl$setControlElementVisibility$in(showElement) {
if (!Srch.U.n(this.get_element())) {
this.get_element().style.display = (showElement) ? '' : 'none';
}
},
clickHandler: function Srch_ClientControl$clickHandler$in(evt) {
if (!Srch.U.n(evt) && !Srch.U.n(evt.target)) {
var $v_0 = Srch.U.getParentAttributeByName(evt.target, 'clicktype');
if (!Srch.U.e($v_0)) {
Srch.U.logClick(evt.target, $v_0);
}
var $v_1 = Srch.U.getParentElementByName(evt.target, 'A');
if (!Srch.U.n($v_1)) {
var $v_2 = $v_1.href;
if (!Srch.U.n($v_2)) {
var $v_3 = $v_1.protocol;
var $v_4 = $v_1.hostname;
if ((!Srch.U.n($v_2)) && (!Srch.U.n($v_3)) && (!Srch.U.n($v_4)) && (!Srch.U.n(window.self.location)) && ($v_3 === window.self.location.protocol) && ($v_4.toLowerCase() === window.self.location.hostname.toLowerCase())) {
var $v_5 = ajaxNavigate.get_href();
var $v_6 = $v_5.indexOf('#');
if ($v_6 !== -1) {
$v_5 = $v_5.substring(0, $v_6);
}
Srch.U.setCookie('WOPISessionContext', $v_5, null, null, '/');
var $v_7 = $v_1.getAttribute('openApp');
if (!Srch.U.e($v_7)) {
if (TypeofFullName('navigator.msLaunchUri') === 'function') {
var $v_9 = $v_7 + ':ofv|u|' + $v_2.trim();
var $$t_E = this;
navigator.msLaunchUri($v_9, null, function() {
window.self.location.href = $v_2;
});
Srch.U.cancelEventEx(evt, true, false);
return;
}
}
var $v_8 = $v_1.getAttribute('openControl');
if (!Srch.U.e($v_8)) {
try {
if (window.self.ActiveXObject) {
var $v_A = null;
try {
$v_A = new ActiveXObject('AcroPDF.PDF');
}
catch ($v_B) {
}
if (Srch.U.n($v_A)) {
$v_A = new ActiveXObject($v_8);
}
if (!Srch.U.n($v_A)) {
if ($v_8 === 'PdfFile.OpenDocuments') {
$v_2 = $v_2.split('#')[0];
}
if ($v_A.ViewDocument2(window.self, $v_2)) {
Srch.U.cancelEventEx(evt, true, false);
return;
}
}
}
}
catch ($v_C) {
}
}
}
}
}
}
},
$5a_2: function Srch_ClientControl$$5a_2$in($p0) {
return this.$3O_2($p0) || Srch.ClientControl.$3P($p0);
},
$3O_2: function Srch_ClientControl$$3O_2$in($p0) {
return Srch.U.isPageInEditMode() || (!$p0.showInEditModeOnly && this.$5t_2());
},
$5t_2: function Srch_ClientControl$$5t_2$in() {
var $v_0 = Srch.ScriptApplicationManager.get_current().states['showAdminDetails'];
if (Srch.U.n($v_0)) {
return true;
}
return $v_0;
},
$5Z_2: function Srch_ClientControl$$5Z_2$in($p0) {
return (Srch.ClientControl.$3P($p0) && !Srch.U.w($p0.messageDetailsForViewers)) || (this.$3O_2($p0) && !Srch.U.w($p0.messageDetails));
},
$W_2: null,
$a_2: null,
$17_2: null,
$1w_2: 0,
$X_2: '',
$16_2: false,
$2j_2: function Srch_ClientControl$$2j_2$in($p0, $p1) {
if (Srch.U.n(this.$7_2)) {
return false;
}
var $v_0 = false;
for (var $$arr_3 = $p0, $$len_4 = $$arr_3.length, $$idx_5 = 0; $$idx_5 < $$len_4; ++$$idx_5) {
var $v_1 = $$arr_3[$$idx_5];
if (this.$5a_2($v_1)) {
if (this.$1w_2 < $v_1.level) {
this.$1w_2 = $v_1.level;
if (Srch.U.n($v_1.header)) {
if (!Srch.U.n(this.$v_2) && !Srch.U.w(Srch.U.trimExtraSpaces(this.$v_2))) {
this.$X_2 = this.$v_2;
}
else {
this.$X_2 = Srch.U.loadResource('cc_err_WebPartErrorMessageDisplayHeader');
if (Srch.U.w(this.$X_2)) {
this.$X_2 = 'Sorry, search isn\'t working right now. Try back a bit later';
}
}
}
else {
this.$X_2 = $v_1.header;
}
}
if ($v_1.level === 2 || $v_1.level === 1) {
$p1.push($v_1);
this.$1_2('ProcessCategoryMessages', $v_1.toString());
}
else if (!$v_1.level) {
this.$17_2.push($v_1);
}
if (!$v_0 && this.$5Z_2($v_1)) {
this.$16_2 = true;
$v_0 = true;
}
else if (!this.$16_2 && !Srch.U.w($v_1.correlationID)) {
this.$16_2 = true;
}
}
}
return $v_0;
},
$34_2: null,
$5D_2: function Srch_ClientControl$$5D_2$in($p0, $p1, $p2, $p3, $p4) {
this.$34_2 = {};
if (!$p4) {
this.$W_2 = [];
this.$a_2 = [];
this.$17_2 = [];
this.$16_2 = false;
this.$1w_2 = 0;
this.$X_2 = '';
this.$2j_2($p0, this.$W_2);
}
if (this.$2z_2) {
this.$2j_2($p1, this.$W_2);
}
var $v_0 = this.$2j_2($p2, this.$a_2);
$v_0 = !!($v_0 | this.$2j_2($p3, this.$a_2));
var $v_1 = new Sys.StringBuilder();
if (!Srch.U.n(this.$17_2) && this.$17_2.length > 0) {
$v_1.append('<div class=\"ms-status-msg ms-status-blue\">');
this.$1o_2 = true;
this.$3F_2($v_1, this.$17_2);
$v_1.append('</div>');
}
if ((!Srch.U.n(this.$W_2) && this.$W_2.length > 0) || (!Srch.U.n(this.$a_2) && this.$a_2.length > 0)) {
$v_1.append('<h2 class=\"ms-search-header, ms-srch-error-header\">' + this.$X_2 + '</h2>');
if (this.$16_2) {
var $v_2 = Srch.U.$F('cc_err_ShowMessageDetails', false);
if (Srch.U.w($v_2)) {
$v_2 = 'SHOW DETAILS';
}
var $v_3 = Srch.U.$F('cc_err_HideMessageDetails', false);
if (Srch.U.w($v_3)) {
$v_3 = 'HIDE DETAILS';
}
var $v_4 = 'ms-status-red';
if (this.$1w_2 === 1) {
$v_4 = 'ms-status-yellow';
}
$v_1.append(String.format(Srch.ClientControl.$4N, SP.Utilities.HttpUtility.htmlEncode($v_2), SP.Utilities.HttpUtility.htmlEncode($v_3), $v_4));
this.$1o_2 = true;
this.$3F_2($v_1, this.$W_2);
if ($v_0) {
this.$5E_2($v_1);
this.$3F_2($v_1, this.$a_2);
}
$v_1.append('</div></div>');
}
}
return $v_1.toString();
},
$5E_2: function Srch_ClientControl$$5E_2$in($p0) {
this.$3E_2($p0);
var $v_0 = Srch.U.$F('cc_err_RenderingErrorMessageDisplayHeader', false);
if (Srch.U.w($v_0)) {
$v_0 = '<strong>Display Error:</strong> The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.';
}
$p0.append(String.format(Srch.ClientControl.$1x, $v_0));
},
$3F_2: function Srch_ClientControl$$3F_2$in($p0, $p1) {
for (var $$arr_2 = $p1, $$len_3 = $$arr_2.length, $$idx_4 = 0; $$idx_4 < $$len_3; ++$$idx_4) {
var $v_0 = $$arr_2[$$idx_4];
if (this.$3O_2($v_0) && !Srch.U.w($v_0.messageDetails)) {
var $v_1 = ($v_0.encodeDetails) ? SP.Utilities.HttpUtility.htmlEncode($v_0.messageDetails) : $v_0.messageDetails;
this.$3t_2($p0, String.format(Srch.ClientControl.$1x, $v_1));
}
else if (Srch.ClientControl.$3P($v_0) && !Srch.U.w($v_0.messageDetailsForViewers)) {
var $v_2 = ($v_0.encodeDetails) ? SP.Utilities.HttpUtility.htmlEncode($v_0.messageDetailsForViewers) : $v_0.messageDetailsForViewers;
this.$3t_2($p0, String.format(Srch.ClientControl.$1x, $v_2));
}
this.$5C_2($p0, $v_0.correlationID);
}
},
$5C_2: function Srch_ClientControl$$5C_2$in($p0, $p1) {
if (!Srch.U.w($p1)) {
this.$3E_2($p0);
var $v_0 = Srch.U.$F('cc_err_CorrelationIdMessage', false);
if (Srch.U.w($v_0)) {
$v_0 = '<strong>Correlation ID:</strong> {0}';
}
$p0.append(String.format(Srch.ClientControl.$1x, String.format($v_0, $p1)));
}
},
$3t_2: function Srch_ClientControl$$3t_2$in($p0, $p1) {
if (!this.$34_2[$p1]) {
this.$34_2[$p1] = true;
this.$3E_2($p0);
$p0.append($p1);
return true;
}
return false;
},
$1o_2: false,
$3E_2: function Srch_ClientControl$$3E_2$in($p0) {
if (this.$1o_2) {
this.$1o_2 = false;
}
else {
$p0.append('<br />');
}
},
$1_2: function Srch_ClientControl$$1_2$in($p0, $p1) {
Srch.U.trace(this, $p0, $p1);
},
$3_2: function Srch_ClientControl$$3_2$in($p0, $p1) {
var $p2 = [];
for (var $$pai_3 = 2; $$pai_3 < arguments.length; ++$$pai_3) {
$p2[$$pai_3 - 2] = arguments[$$pai_3];
}
Srch.U.traceFormatted.apply(null, [ this, $p0, $p1 ].concat($p2));
}
}
Srch.DataProvider = function Srch_DataProvider(elem) {
this.$$d_$5Q_3 = Function.createDelegate(this, this.$5Q_3);
this.$$d_$5w_3 = Function.createDelegate(this, this.$5w_3);
this.$$d_searchBox_BatchResultReady = Function.createDelegate(this, this.searchBox_BatchResultReady);
this.$$d_searchBox_BatchQueryIssuing = Function.createDelegate(this, this.searchBox_BatchQueryIssuing);
this.$$d_searchBox_QueryReady = Function.createDelegate(this, this.searchBox_QueryReady);
this.$$d_displayControl_QueryReady = Function.createDelegate(this, this.displayControl_QueryReady);
this.$$d_$4q_3 = Function.createDelegate(this, this.$4q_3);
this.$2G_3 = [];
this.$3a_3 = SP.Guid.get_empty();
this.$2_3 = Srch.QueryState.$5G();
this.$1t_3 = new Srch.QueryState();
this.$1l_3 = -1;
this.$1s_3 = -1;
this.$2I_3 = -1;
Srch.DataProvider.initializeBase(this, [ elem ]);
}
Srch.DataProvider.$4A = function Srch_DataProvider$$4A$st($p0, $p1) {
if (!Srch.U.n($p0) && !Srch.U.n($p0.queryStateUpdateOption) && $p0.queryStateUpdateOption !== -1) {
return $p0.queryStateUpdateOption;
}
return $p1;
}
Srch.DataProvider.prototype = {
$28_3: false,
$21_3: 0,
$u_3: null,
$3N_3: false,
$3M_3: false,
get_$27_3: function Srch_DataProvider$get_$27_3$in() {
return this.$3a_3.toString() + this.$5_3;
},
get_$4O_3: function Srch_DataProvider$get_$4O_3$in() {
this.$3a_3 = SP.Guid.newGuid();
return this.get_$27_3();
},
get_currentQueryState: function Srch_DataProvider$get_currentQueryState$in() {
return this.$2_3;
},
get_sourceID: function Srch_DataProvider$get_sourceID$in() {
return this.$1Q_3;
},
set_sourceID: function Srch_DataProvider$set_sourceID$in(value) {
this.$1Q_3 = value;
return value;
},
$1Q_3: '',
get_sourceName: function Srch_DataProvider$get_sourceName$in() {
return this.$1S_3;
},
set_sourceName: function Srch_DataProvider$set_sourceName$in(value) {
this.$1S_3 = value;
return value;
},
$1S_3: '',
get_sourceLevel: function Srch_DataProvider$get_sourceLevel$in() {
return this.$1R_3;
},
set_sourceLevel: function Srch_DataProvider$set_sourceLevel$in(value) {
this.$1R_3 = value;
return value;
},
$1R_3: '',
get_collapseSpecification: function Srch_DataProvider$get_collapseSpecification$in() {
return this.$1U_3;
},
set_collapseSpecification: function Srch_DataProvider$set_collapseSpecification$in(value) {
this.$1U_3 = value;
return value;
},
$1U_3: '',
get_queryGroupName: function Srch_DataProvider$get_queryGroupName$in() {
return this.$5_3;
},
set_queryGroupName: function Srch_DataProvider$set_queryGroupName$in(value) {
this.$5_3 = value;
return value;
},
$5_3: '',
get_queryPropertiesTemplateUrl: function Srch_DataProvider$get_queryPropertiesTemplateUrl$in() {
return this.$23_3;
},
set_queryPropertiesTemplateUrl: function Srch_DataProvider$set_queryPropertiesTemplateUrl$in(value) {
this.$23_3 = value;
return value;
},
$23_3: '',
get_queryTemplate: function Srch_DataProvider$get_queryTemplate$in() {
return this.$o_3;
},
set_queryTemplate: function Srch_DataProvider$set_queryTemplate$in(value) {
this.$o_3 = value;
return value;
},
$o_3: '{searchboxquery}',
get_fallbackSort: function Srch_DataProvider$get_fallbackSort$in() {
return this.$1n_3;
},
set_fallbackSort: function Srch_DataProvider$set_fallbackSort$in(value) {
this.$1n_3 = value;
return value;
},
$1n_3: null,
get_rankRules: function Srch_DataProvider$get_rankRules$in() {
return this.$p_3;
},
set_rankRules: function Srch_DataProvider$set_rankRules$in(value) {
this.$p_3 = value;
return value;
},
$p_3: null,
get_initialQueryState: function Srch_DataProvider$get_initialQueryState$in() {
return this.$1t_3;
},
set_initialQueryState: function Srch_DataProvider$set_initialQueryState$in(value) {
this.$1t_3.copyFrom(value, 0);
return value;
},
get_initialResult: function Srch_DataProvider$get_initialResult$in() {
return this.$i_3;
},
set_initialResult: function Srch_DataProvider$set_initialResult$in(value) {
this.$i_3 = value;
return value;
},
$i_3: '',
get_initialResultRef: function Srch_DataProvider$get_initialResultRef$in() {
return this.$j_3;
},
set_initialResultRef: function Srch_DataProvider$set_initialResultRef$in(value) {
this.$j_3 = value;
return value;
},
$j_3: null,
get_initialResultObject: function Srch_DataProvider$get_initialResultObject$in() {
var $v_0 = null;
var $v_1 = new SP.CScope('DataProvider.InitialResultObject');
$v_1.start();
if (!Srch.U.e(this.$i_3)) {
this.$1_2('InitialResultObject', 'Deserializing InitialResult json string');
try {
$v_0 = Srch.ParseJSONUtil.parseObjectFromJsonString(this.$i_3);
$v_1.stop();
return $v_0;
}
catch ($v_2) {
this.$3_2('InitialResultObject', 'Could not deserialize json string: {0} error: {1}', this.$i_3, $v_2.message);
}
}
else if (Srch.U.e(this.$i_3) && !Srch.U.e(this.$j_3) && typeof(this.$j_3) !== 'undefined') {
this.$3_2('InitialResultObject', 'Processing server generated JSON obect literal for InitialResultRef: {0}', this.$j_3);
$v_0 = eval(this.$j_3);
Srch.ParseJSONUtil.evaluateTokensInJsonObject($v_0);
return $v_0;
}
$v_1.stop();
return null;
},
get_batched: function Srch_DataProvider$get_batched$in() {
return this.$w_3;
},
set_batched: function Srch_DataProvider$set_batched$in(value) {
this.$w_3 = value;
return value;
},
$w_3: true,
get_active: function Srch_DataProvider$get_active$in() {
return this.$S_3;
},
set_active: function Srch_DataProvider$set_active$in(value) {
this.$S_3 = value;
return value;
},
$S_3: true,
get_bypassResultTypes: function Srch_DataProvider$get_bypassResultTypes$in() {
return this.bypassResultTypes;
},
set_bypassResultTypes: function Srch_DataProvider$set_bypassResultTypes$in(value) {
this.bypassResultTypes = value;
return value;
},
bypassResultTypes: false,
get_processBestBets: function Srch_DataProvider$get_processBestBets$in() {
return this.processBestBets;
},
set_processBestBets: function Srch_DataProvider$set_processBestBets$in(value) {
this.processBestBets = value;
return value;
},
processBestBets: true,
get_processPersonalFavorites: function Srch_DataProvider$get_processPersonalFavorites$in() {
return this.$29_3;
},
set_processPersonalFavorites: function Srch_DataProvider$set_processPersonalFavorites$in(value) {
this.$29_3 = value;
return value;
},
$29_3: true,
get_resultsPerPage: function Srch_DataProvider$get_resultsPerPage$in() {
return this.$r_3;
},
set_resultsPerPage: function Srch_DataProvider$set_resultsPerPage$in(value) {
this.$r_3 = value;
return value;
},
$r_3: 10,
get_selectedRefiners: function Srch_DataProvider$get_selectedRefiners$in() {
return this.$P_3;
},
set_selectedRefiners: function Srch_DataProvider$set_selectedRefiners$in(value) {
this.$P_3 = value;
return value;
},
$P_3: null,
get_selectedProperties: function Srch_DataProvider$get_selectedProperties$in() {
return this.$d_3;
},
set_selectedProperties: function Srch_DataProvider$set_selectedProperties$in(value) {
this.$d_3 = value;
return value;
},
$d_3: null,
get_hitHighlightedProperties: function Srch_DataProvider$get_hitHighlightedProperties$in() {
return this.$Y_3;
},
set_hitHighlightedProperties: function Srch_DataProvider$set_hitHighlightedProperties$in(value) {
this.$Y_3 = value;
return value;
},
$Y_3: null,
get_fallbackLanguage: function Srch_DataProvider$get_fallbackLanguage$in() {
return this.$1l_3;
},
set_fallbackLanguage: function Srch_DataProvider$set_fallbackLanguage$in(value) {
this.$1l_3 = value;
return value;
},
get_fallbackRankingModelID: function Srch_DataProvider$get_fallbackRankingModelID$in() {
return this.$1m_3;
},
set_fallbackRankingModelID: function Srch_DataProvider$set_fallbackRankingModelID$in(value) {
this.$1m_3 = value;
return value;
},
$1m_3: '',
get_fallbackRefinementFilters: function Srch_DataProvider$get_fallbackRefinementFilters$in() {
return this.$f_3;
},
set_fallbackRefinementFilters: function Srch_DataProvider$set_fallbackRefinementFilters$in(value) {
this.$f_3 = Srch.U.$2Q(value, Srch.RefinementCategory);
return value;
},
$f_3: null,
get_availableSorts: function Srch_DataProvider$get_availableSorts$in() {
return this.$T_3;
},
set_availableSorts: function Srch_DataProvider$set_availableSorts$in(value) {
this.$T_3 = value;
return value;
},
$T_3: null,
get_contextualScopeUrl: function Srch_DataProvider$get_contextualScopeUrl$in() {
return this.$1V_3;
},
set_contextualScopeUrl: function Srch_DataProvider$set_contextualScopeUrl$in(value) {
this.$1V_3 = value;
return value;
},
$1V_3: '',
get_totalRows: function Srch_DataProvider$get_totalRows$in() {
return this.$9_3;
},
$9_3: 0,
get_rowCount: function Srch_DataProvider$get_rowCount$in() {
return this.$O_3;
},
$O_3: 0,
get_refinementInfo: function Srch_DataProvider$get_refinementInfo$in() {
return this.$q_3;
},
$q_3: null,
get_entityInfo: function Srch_DataProvider$get_entityInfo$in() {
return this.$V_3;
},
$V_3: null,
get_enableStemming: function Srch_DataProvider$get_enableStemming$in() {
return this.$1j_3;
},
set_enableStemming: function Srch_DataProvider$set_enableStemming$in(value) {
this.$1j_3 = value;
return value;
},
$1j_3: true,
get_enablePhonetic: function Srch_DataProvider$get_enablePhonetic$in() {
return this.$1h_3;
},
set_enablePhonetic: function Srch_DataProvider$set_enablePhonetic$in(value) {
this.$1h_3 = value;
return value;
},
$1h_3: false,
get_enableNicknames: function Srch_DataProvider$get_enableNicknames$in() {
return this.$1f_3;
},
set_enableNicknames: function Srch_DataProvider$set_enableNicknames$in(value) {
this.$1f_3 = value;
return value;
},
$1f_3: false,
get_trimDuplicates: function Srch_DataProvider$get_trimDuplicates$in() {
return this.$2J_3;
},
set_trimDuplicates: function Srch_DataProvider$set_trimDuplicates$in(value) {
this.$2J_3 = value;
return value;
},
$2J_3: true,
get_enableInterleaving: function Srch_DataProvider$get_enableInterleaving$in() {
return this.$1e_3;
},
set_enableInterleaving: function Srch_DataProvider$set_enableInterleaving$in(value) {
this.$1e_3 = value;
return value;
},
$1e_3: true,
get_enableQueryRules: function Srch_DataProvider$get_enableQueryRules$in() {
return this.$1i_3;
},
set_enableQueryRules: function Srch_DataProvider$set_enableQueryRules$in(value) {
this.$1i_3 = value;
return value;
},
$1i_3: true,
get_enableOrderingHitHighlightedProperty: function Srch_DataProvider$get_enableOrderingHitHighlightedProperty$in() {
return this.$1g_3;
},
set_enableOrderingHitHighlightedProperty: function Srch_DataProvider$set_enableOrderingHitHighlightedProperty$in(value) {
this.$1g_3 = value;
return value;
},
$1g_3: false,
get_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$get_hitHighlightedMultivaluePropertyLimit$in() {
return this.$1s_3;
},
set_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$set_hitHighlightedMultivaluePropertyLimit$in(value) {
this.$1s_3 = value;
return value;
},
get_properties: function Srch_DataProvider$get_properties$in() {
if (!this.$1v_3) {
this.$1v_3 = {};
}
return this.$1v_3;
},
set_properties: function Srch_DataProvider$set_properties$in(value) {
this.$1v_3 = value;
return value;
},
$1v_3: null,
get_clientType: function Srch_DataProvider$get_clientType$in() {
return this.$2N_3;
},
set_clientType: function Srch_DataProvider$set_clientType$in(value) {
this.$2N_3 = value;
return value;
},
$2N_3: '',
get_maxPagesAfterCurrent: function Srch_DataProvider$get_maxPagesAfterCurrent$in() {
return this.$Z_3;
},
set_maxPagesAfterCurrent: function Srch_DataProvider$set_maxPagesAfterCurrent$in(value) {
this.$Z_3 = value;
return value;
},
$Z_3: 0,
get_userAction: function Srch_DataProvider$get_userAction$in() {
return this.$R_3;
},
set_userAction: function Srch_DataProvider$set_userAction$in(value) {
this.$R_3 = value;
return value;
},
$R_3: 0,
get_queryCount: function Srch_DataProvider$get_queryCount$in() {
return this.$22_3;
},
set_queryCount: function Srch_DataProvider$set_queryCount$in(value) {
this.$22_3 = value;
return value;
},
$22_3: 0,
get_resultsUrl: function Srch_DataProvider$get_resultsUrl$in() {
if (!this.$2u_3) {
return ajaxNavigate.get_href();
}
return this.$2u_3;
},
set_resultsUrl: function Srch_DataProvider$set_resultsUrl$in(value) {
this.$2u_3 = value;
return value;
},
$2u_3: null,
get_upScopeUrl: function Srch_DataProvider$get_upScopeUrl$in() {
var $v_0 = Srch.ScriptApplicationManager.get_current().states['searchCenterUrl'];
if (!Srch.U.e($v_0)) {
$v_0 = Srch.U.concatUrl(Srch.U.replaceUrlTokens($v_0), String.format('results.aspx?k={0}', SP.Utilities.HttpUtility.urlKeyValueEncode(this.$2_3.k)));
}
return $v_0;
},
get_effectiveQueryLanguage: function Srch_DataProvider$get_effectiveQueryLanguage$in() {
var $v_0 = -1;
var $v_1 = '';
if ($v_0 < 1 && this.$1l_3 > 0) {
$v_0 = this.$1l_3;
$v_1 = ' from fallback language...';
}
if ($v_0 < 1 && this.$2_3.l > 0) {
$v_0 = this.$2_3.l;
$v_1 = ' from query state...';
}
if ($v_0 < 1) {
var $v_2 = Srch.ScriptApplicationManager.get_current().states['languages'];
if (!Srch.U.n($v_2) && $v_2.length > 0) {
var $v_3 = $v_2[0];
if (!Srch.U.n($v_3)) {
$v_0 = $v_3.id;
$v_1 = ' from default user preference language...';
}
}
}
if ($v_0 < 1) {
var $v_4 = Srch.ScriptApplicationManager.get_current().states['browserLanguage'];
if ($v_4 > 0) {
$v_0 = $v_4;
$v_1 = ' from browser language...';
}
}
this.$3_2('GetLanguage', 'Setting query languge to \'{0}\'' + $v_1, $v_0);
return $v_0;
},
get_effectiveLanguageDisplayName: function Srch_DataProvider$get_effectiveLanguageDisplayName$in() {
return Srch.ScriptApplicationManager.get_current().getDisplayNameByLanguageID(this.get_effectiveQueryLanguage());
},
get_$59_3: function Srch_DataProvider$get_$59_3$in() {
var $v_0 = null;
var $v_1 = 'Not using explicit sort...';
if (!Srch.U.n(this.$2_3.o)) {
$v_0 = this.$2_3.o;
$v_1 = 'Using query state sorts...';
}
var $v_2 = this.$T_3;
if (Srch.U.n($v_0) && !Srch.U.n($v_2) && $v_2.length > 0) {
var $v_3 = $v_2[0].sorts;
if (!Srch.U.n($v_3)) {
$v_0 = $v_3;
$v_1 = 'Using default available sorts...';
}
}
if (Srch.U.n($v_0) && !Srch.U.n(this.$1n_3)) {
$v_0 = this.$1n_3;
$v_1 = 'Using fall back sorts...';
}
this.$1_2('GetSorts', $v_1);
return $v_0;
},
get_parentImpressionID: function Srch_DataProvider$get_parentImpressionID$in() {
return this.$1G_3;
},
set_p