sp-jsom-node
Version:
SharePoint JavaScript Object Model for Node.js
1,366 lines (1,188 loc) • 357 kB
JavaScript
//***********IMPORTANT!!!! READ THIS!!!!!!***********************************
//Don't add script in this file! Only function alias is allowed in this file!
//***************************************************************************
Type.registerNamespace('Microsoft.SharePoint.Client.Search.Query');
Microsoft.SharePoint.Client.Search.Query.KnownTableTypes = function Microsoft_SharePoint_Client_Search_Query_KnownTableTypes() {
}
Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.isKnownTableType = function Microsoft_SharePoint_Client_Search_Query_KnownTableTypes$isKnownTableType(tableType) {
return tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.relevantResults || tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.specialTermResults || tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.definitionResults || tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.refinementResults || tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.interleavingInformation || tableType === Microsoft.SharePoint.Client.Search.Query.KnownTableTypes.personalFavoriteResults;
}
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.$T_2 = [];
this.$v_2 = [];
Srch.ClientControl.initializeBase(this, [ elem ]);
}
Srch.ClientControl.toggleMessageDetails = function Srch_ClientControl$toggleMessageDetails(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.$2u = function Srch_ClientControl$$2u($p0) {
return $p0.showForViewerUsers;
}
Srch.ClientControl.prototype = {
alternateRenderer: null,
alternateRenderContext: null,
$1S_2: null,
$1J_2: null,
$1R_2: null,
loaded: false,
get_nextUniqueId: function Srch_ClientControl$get_nextUniqueId() {
this.$3v_2++;
return this.get_id() + this.$3v_2;
},
$3v_2: 0,
get_renderTemplateId: function Srch_ClientControl$get_renderTemplateId() {
return this.$2L_2;
},
set_renderTemplateId: function Srch_ClientControl$set_renderTemplateId(value) {
this.$2L_2 = value;
return value;
},
$2L_2: '',
get_delayLoadTemplateScripts: function Srch_ClientControl$get_delayLoadTemplateScripts() {
return this.$18_2;
},
set_delayLoadTemplateScripts: function Srch_ClientControl$set_delayLoadTemplateScripts(value) {
this.$18_2 = value;
return value;
},
$18_2: true,
get_states: function Srch_ClientControl$get_states() {
if (!this.$2U_2) {
this.$2U_2 = {};
}
return this.$2U_2;
},
set_states: function Srch_ClientControl$set_states(value) {
this.$2U_2 = value;
return value;
},
$2U_2: null,
get_messages: function Srch_ClientControl$get_messages() {
return this.$1M_2;
},
set_messages: function Srch_ClientControl$set_messages(value) {
if (!Srch.U.n(value) && value.length > 0) {
this.$1M_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.$1M_2, Srch.ControlMessage.getIfControlMessage($v_1));
}
}
}
else {
this.$1M_2 = value;
}
return value;
},
$1M_2: null,
get_showDataErrors: function Srch_ClientControl$get_showDataErrors() {
return this.$3H_2;
},
set_showDataErrors: function Srch_ClientControl$set_showDataErrors(value) {
this.$3H_2 = value;
return value;
},
$3H_2: false,
get_alternateErrorMessage: function Srch_ClientControl$get_alternateErrorMessage() {
return this.$z_2;
},
set_alternateErrorMessage: function Srch_ClientControl$set_alternateErrorMessage(value) {
this.$z_2 = value;
return value;
},
$z_2: null,
get_isInitialLoad: function Srch_ClientControl$get_isInitialLoad() {
return !this.loaded;
},
initialize: function Srch_ClientControl$initialize() {
this.$1_2('Initialize', '');
Srch.ScriptApplicationManager.get_current().registerClientControl(this);
this.$1S_2 = this.$$d_scriptApplication_PreLoad;
Srch.ScriptApplicationManager.get_current().add_preLoad(this.$1S_2);
this.$1J_2 = this.$$d_scriptApplication_Load;
Srch.ScriptApplicationManager.get_current().add_load(this.$1J_2);
this.$1R_2 = this.$$d_scriptApplication_PostLoad;
Srch.ScriptApplicationManager.get_current().add_postLoad(this.$1R_2);
if (!Srch.U.n(this.get_element())) {
$addHandler(this.get_element(), 'click', this.$$d_clickHandler);
}
Sys.Component.prototype.initialize.call(this);
},
dispose: function Srch_ClientControl$dispose() {
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.$1S_2)) {
Srch.ScriptApplicationManager.get_current().remove_preLoad(this.$1S_2);
this.$1S_2 = null;
}
if (!Srch.U.n(this.$1J_2)) {
Srch.ScriptApplicationManager.get_current().remove_load(this.$1J_2);
this.$1J_2 = null;
}
if (!Srch.U.n(this.$1R_2)) {
Srch.ScriptApplicationManager.get_current().remove_postLoad(this.$1R_2);
this.$1R_2 = null;
}
}
finally {
Sys.Component.prototype.dispose.call(this);
}
$v_0.stop();
},
renderControl: function Srch_ClientControl$renderControl(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(dataProviderToProcess) {
if (!Srch.U.n(dataProviderToProcess) && !Srch.U.n(dataProviderToProcess.get_messages()) && dataProviderToProcess.get_messages().length > 0) {
this.processDataErrorMessages(dataProviderToProcess.get_messages());
}
},
scriptApplication_PreLoad: function Srch_ClientControl$scriptApplication_PreLoad(sender, e) {
this.$1_2('ScriptApplication_PreLoad', 'ClientControl');
if (this.$18_2) {
Srch.U.appendScriptsToLoad(this.serverTemplateScriptsToLoad, this.$2L_2);
}
},
scriptApplication_Load: function Srch_ClientControl$scriptApplication_Load(sender, e) {
this.$1_2('ScriptApplication_Load', 'ClientControl');
},
scriptApplication_PostLoad: function Srch_ClientControl$scriptApplication_PostLoad(sender, e) {
this.$1_2('ScriptApplication_PostLoad', 'ClientControl');
this.loaded = true;
},
loadServerTemplateScripts: function Srch_ClientControl$loadServerTemplateScripts() {
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() {
this.$1_2('ServerTemplateScriptsCallback', 'ServerTemplateScriptsCallback');
this.serverTemplateScriptsToLoad = [];
},
loadRenderTemplateScripts: function Srch_ClientControl$loadRenderTemplateScripts(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.$5T_2($p1_0, success, failure, timeout);
}, function($p1_0) {
$$t_8.$5S_2($p1_0, failure);
}, timeout)) {
return true;
}
this.$1_2('LoadRenderTemplateScripts', 'Did not discover new render template script to load.');
if (loadStandAloneCustomScripts) {
return this.$3m_2(success, failure, timeout);
}
else {
this.$1_2('LoadRenderTemplateScripts', 'Skip loading custom scripts.');
return false;
}
},
$5T_2: function Srch_ClientControl$$5T_2($p0, $p1, $p2, $p3) {
this.$1_2('RenderTemplateScriptsLoaded', 'All render template scripts loaded.');
Srch.U.registerLoadedScripts($p0);
if (this.$3m_2($p1, $p2, $p3)) {
return;
}
$p1();
},
$5S_2: function Srch_ClientControl$$5S_2($p0, $p1) {
this.$1_2('RenderTemplateScriptsFailed', 'Loading render template scripts faild.');
this.$3x_2($p0);
$p1();
},
$3m_2: function Srch_ClientControl$$3m_2($p0, $p1, $p2) {
this.$1_2('LoadCustomScripts', 'Loading custom scripts...');
if (!Srch.U.n(Srch.ScriptApplicationManager.get_current().$16_1)) {
var $v_0 = [];
var $$dict_4 = Srch.ScriptApplicationManager.get_current().$16_1;
for (var $$key_5 in $$dict_4) {
var $v_1 = { key: $$key_5, value: $$dict_4[$$key_5] };
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().$n_1[$v_3])) {
registerCssLink($v_3);
Srch.U.traceFormatted(null, 'LoadCustomScripts', 'Registering css \'{0}\' as loaded', $v_3);
Srch.ScriptApplicationManager.get_current().$n_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.$4o_2($p1_0, $p0);
}, function($p1_0) {
$$t_C.$4n_2($p1_0, $p1);
}, $p2)) {
return true;
}
}
this.$1_2('LoadCustomScripts', 'Did not discover new custom script to load.');
return false;
},
$4o_2: function Srch_ClientControl$$4o_2($p0, $p1) {
this.$1_2('CustomScriptsLoaded', 'All custom scripts loaded.');
Srch.U.registerLoadedScripts($p0);
$p1();
},
$4n_2: function Srch_ClientControl$$4n_2($p0, $p1) {
this.$1_2('CustomScriptsFailed', 'Loading custom scripts failed.');
var $v_0 = this.$3x_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.get_messages(), $v_3);
$p1();
},
$3x_2: function Srch_ClientControl$$3x_2($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(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(node, ctx) {
var $v_0 = new SP.CScope('ClientControl.InvokeClientRenderer');
$v_0.start();
SPClientRenderer.Render(node, ctx);
$v_0.stop();
},
$L_2: null,
$4t_2: function Srch_ClientControl$$4t_2() {
if (Srch.U.n(this.$L_2) && !Srch.U.n(this.get_element())) {
this.$L_2 = document.createElement('div');
this.$L_2.style.display = 'none';
var $v_0 = this.get_element().parentNode;
$v_0.insertBefore(this.$L_2, this.get_element());
}
},
processDataErrorMessages: function Srch_ClientControl$processDataErrorMessages(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.$T_2, $v_0);
}
}
},
processRenderingErrorMessages: function Srch_ClientControl$processRenderingErrorMessages(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.$v_2, Srch.ControlMessage.getFromException($v_1));
}
ctx['Errors'] = null;
}
},
hasMessages: function Srch_ClientControl$hasMessages() {
var $v_0 = Srch.U.$2p();
return (!!this.get_messages() && this.get_messages().length > 0) || (!!this.$T_2 && this.$T_2.length > 0) || (!!this.$v_2 && this.$v_2.length > 0) || (!!$v_0 && $v_0.length > 0);
},
updateDisplayControlWithNewMessages: function Srch_ClientControl$updateDisplayControlWithNewMessages() {
this.$3V_2(true);
},
displayControlMessages: function Srch_ClientControl$displayControlMessages() {
this.$3V_2(false);
},
$3V_2: function Srch_ClientControl$$3V_2($p0) {
var $v_0 = this.$4v_2(this.get_messages(), this.$T_2, this.$v_2, Srch.U.$2p(), $p0);
if (!Srch.U.w($v_0) || !$p0) {
var $v_1 = this.$V_2.length > 0 || this.$b_2.length > 0 || this.$T_2.length > 0;
this.$4t_2();
if (!Srch.U.w($v_0)) {
this.$L_2.innerHTML = $v_0;
this.$L_2.style.display = '';
}
else {
this.$L_2.innerHTML = '';
this.$L_2.style.display = 'none';
}
this.setControlElementVisibility(!$v_1);
}
this.$T_2 = [];
this.$v_2 = [];
Srch.U.$5V();
},
setControlElementVisibility: function Srch_ClientControl$setControlElementVisibility(showElement) {
if (!Srch.U.n(this.get_element())) {
this.get_element().style.display = (showElement) ? '' : 'none';
}
},
clickHandler: function Srch_ClientControl$clickHandler(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) {
}
}
}
}
}
}
},
$5G_2: function Srch_ClientControl$$5G_2($p0) {
return this.$2t_2($p0) || Srch.ClientControl.$2u($p0);
},
$2t_2: function Srch_ClientControl$$2t_2($p0) {
return Srch.U.isPageInEditMode() || (!$p0.showInEditModeOnly && this.$5X_2());
},
$5X_2: function Srch_ClientControl$$5X_2() {
var $v_0 = Srch.ScriptApplicationManager.get_current().states['showAdminDetails'];
if (Srch.U.n($v_0)) {
return true;
}
return $v_0;
},
$5F_2: function Srch_ClientControl$$5F_2($p0) {
return (Srch.ClientControl.$2u($p0) && !Srch.U.w($p0.messageDetailsForViewers)) || (this.$2t_2($p0) && !Srch.U.w($p0.messageDetails));
},
$V_2: null,
$b_2: null,
$1H_2: null,
$2A_2: 0,
$X_2: '',
$1F_2: false,
$2F_2: function Srch_ClientControl$$2F_2($p0, $p1) {
if (Srch.U.n(this.$1M_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.$5G_2($v_1)) {
if (this.$2A_2 < $v_1.level) {
this.$2A_2 = $v_1.level;
if (Srch.U.n($v_1.header)) {
if (!Srch.U.n(this.$z_2) && !Srch.U.w(Srch.U.trimExtraSpaces(this.$z_2))) {
this.$X_2 = this.$z_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.$1H_2.push($v_1);
}
if (!$v_0 && this.$5F_2($v_1)) {
this.$1F_2 = true;
$v_0 = true;
}
else if (!this.$1F_2 && !Srch.U.w($v_1.correlationID)) {
this.$1F_2 = true;
}
}
}
return $v_0;
},
$3L_2: null,
$4v_2: function Srch_ClientControl$$4v_2($p0, $p1, $p2, $p3, $p4) {
this.$3L_2 = {};
if (!$p4) {
this.$V_2 = [];
this.$b_2 = [];
this.$1H_2 = [];
this.$1F_2 = false;
this.$2A_2 = 0;
this.$X_2 = '';
this.$2F_2($p0, this.$V_2);
}
if (this.$3H_2) {
this.$2F_2($p1, this.$V_2);
}
var $v_0 = this.$2F_2($p2, this.$b_2);
$v_0 = !!($v_0 | this.$2F_2($p3, this.$b_2));
var $v_1 = new Sys.StringBuilder();
if (!Srch.U.n(this.$1H_2) && this.$1H_2.length > 0) {
$v_1.append('<div class=\"ms-status-msg ms-status-blue\">');
this.$20_2 = true;
this.$2m_2($v_1, this.$1H_2);
$v_1.append('</div>');
}
if ((!Srch.U.n(this.$V_2) && this.$V_2.length > 0) || (!Srch.U.n(this.$b_2) && this.$b_2.length > 0)) {
$v_1.append('<h2 class=\"ms-search-header, ms-srch-error-header\">' + this.$X_2 + '</h2>');
if (this.$1F_2) {
var $v_2 = Srch.U.$C('cc_err_ShowMessageDetails', false);
if (Srch.U.w($v_2)) {
$v_2 = 'SHOW DETAILS';
}
var $v_3 = Srch.U.$C('cc_err_HideMessageDetails', false);
if (Srch.U.w($v_3)) {
$v_3 = 'HIDE DETAILS';
}
var $v_4 = 'ms-status-red';
if (this.$2A_2 === 1) {
$v_4 = 'ms-status-yellow';
}
$v_1.append(String.format(Srch.ClientControl.$3t, SP.Utilities.HttpUtility.htmlEncode($v_2), SP.Utilities.HttpUtility.htmlEncode($v_3), $v_4));
this.$20_2 = true;
this.$2m_2($v_1, this.$V_2);
if ($v_0) {
this.$4w_2($v_1);
this.$2m_2($v_1, this.$b_2);
}
$v_1.append('</div></div>');
}
}
return $v_1.toString();
},
$4w_2: function Srch_ClientControl$$4w_2($p0) {
this.$2l_2($p0);
var $v_0 = Srch.U.$C('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.$1L, $v_0));
},
$2m_2: function Srch_ClientControl$$2m_2($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.$2t_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.$3P_2($p0, String.format(Srch.ClientControl.$1L, $v_1));
}
else if (Srch.ClientControl.$2u($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.$3P_2($p0, String.format(Srch.ClientControl.$1L, $v_2));
}
this.$4u_2($p0, $v_0.correlationID);
}
},
$4u_2: function Srch_ClientControl$$4u_2($p0, $p1) {
if (!Srch.U.w($p1)) {
this.$2l_2($p0);
var $v_0 = Srch.U.$C('cc_err_CorrelationIdMessage', false);
if (Srch.U.w($v_0)) {
$v_0 = '<strong>Correlation ID:</strong> {0}';
}
$p0.append(String.format(Srch.ClientControl.$1L, String.format($v_0, $p1)));
}
},
$3P_2: function Srch_ClientControl$$3P_2($p0, $p1) {
if (!this.$3L_2[$p1]) {
this.$3L_2[$p1] = true;
this.$2l_2($p0);
$p0.append($p1);
return true;
}
return false;
},
$20_2: false,
$2l_2: function Srch_ClientControl$$2l_2($p0) {
if (this.$20_2) {
this.$20_2 = false;
}
else {
$p0.append('<br />');
}
},
$1_2: function Srch_ClientControl$$1_2($p0, $p1) {
Srch.U.trace(this, $p0, $p1);
},
$3_2: function Srch_ClientControl$$3_2($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_$56_3 = Function.createDelegate(this, this.$56_3);
this.$$d_$5a_3 = Function.createDelegate(this, this.$5a_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_$4W_3 = Function.createDelegate(this, this.$4W_3);
this.$1d_3 = [];
this.$39_3 = SP.Guid.get_empty();
this.$2_3 = Srch.QueryState.$4x();
this.$a_3 = '{searchboxquery}';
this.$2q_3 = new Srch.QueryState();
this.$1B_3 = -1;
this.$1G_3 = -1;
this.$P_3 = 0;
this.$1f_3 = -1;
Srch.DataProvider.initializeBase(this, [ elem ]);
}
Srch.DataProvider.$3e = function Srch_DataProvider$$3e($p0, $p1) {
if (!Srch.U.n($p0) && !Srch.U.n($p0.queryStateUpdateOption) && $p0.queryStateUpdateOption !== -1) {
return $p0.queryStateUpdateOption;
}
return $p1;
}
Srch.DataProvider.prototype = {
$w_3: false,
$y_3: null,
$3o_3: false,
$3n_3: false,
get_$1X_3: function Srch_DataProvider$get_$1X_3() {
return this.$39_3.toString() + this.$5_3;
},
get_$3u_3: function Srch_DataProvider$get_$3u_3() {
this.$39_3 = SP.Guid.newGuid();
return this.get_$1X_3();
},
get_currentQueryState: function Srch_DataProvider$get_currentQueryState() {
return this.$2_3;
},
get_sourceID: function Srch_DataProvider$get_sourceID() {
return this.$1a_3;
},
set_sourceID: function Srch_DataProvider$set_sourceID(value) {
this.$1a_3 = value;
return value;
},
$1a_3: '',
get_sourceName: function Srch_DataProvider$get_sourceName() {
return this.$1c_3;
},
set_sourceName: function Srch_DataProvider$set_sourceName(value) {
this.$1c_3 = value;
return value;
},
$1c_3: '',
get_sourceLevel: function Srch_DataProvider$get_sourceLevel() {
return this.$1b_3;
},
set_sourceLevel: function Srch_DataProvider$set_sourceLevel(value) {
this.$1b_3 = value;
return value;
},
$1b_3: '',
get_collapseSpecification: function Srch_DataProvider$get_collapseSpecification() {
return this.$1h_3;
},
set_collapseSpecification: function Srch_DataProvider$set_collapseSpecification(value) {
this.$1h_3 = value;
return value;
},
$1h_3: '',
get_queryGroupName: function Srch_DataProvider$get_queryGroupName() {
return this.$5_3;
},
set_queryGroupName: function Srch_DataProvider$set_queryGroupName(value) {
this.$5_3 = value;
return value;
},
$5_3: '',
get_queryPropertiesTemplateUrl: function Srch_DataProvider$get_queryPropertiesTemplateUrl() {
return this.$2J_3;
},
set_queryPropertiesTemplateUrl: function Srch_DataProvider$set_queryPropertiesTemplateUrl(value) {
this.$2J_3 = value;
return value;
},
$2J_3: '',
get_queryTemplate: function Srch_DataProvider$get_queryTemplate() {
return this.$a_3;
},
set_queryTemplate: function Srch_DataProvider$set_queryTemplate(value) {
this.$a_3 = value;
return value;
},
get_fallbackSort: function Srch_DataProvider$get_fallbackSort() {
return this.$1x_3;
},
set_fallbackSort: function Srch_DataProvider$set_fallbackSort(value) {
this.$1x_3 = value;
return value;
},
$1x_3: null,
get_rankRules: function Srch_DataProvider$get_rankRules() {
return this.$t_3;
},
set_rankRules: function Srch_DataProvider$set_rankRules(value) {
this.$t_3 = value;
return value;
},
$t_3: null,
get_initialQueryState: function Srch_DataProvider$get_initialQueryState() {
return this.$2q_3;
},
set_initialQueryState: function Srch_DataProvider$set_initialQueryState(value) {
this.$2q_3.copyFrom(value, 0);
return value;
},
get_initialResult: function Srch_DataProvider$get_initialResult() {
return this.$k_3;
},
set_initialResult: function Srch_DataProvider$set_initialResult(value) {
this.$k_3 = value;
return value;
},
$k_3: '',
get_initialResultRef: function Srch_DataProvider$get_initialResultRef() {
return this.$l_3;
},
set_initialResultRef: function Srch_DataProvider$set_initialResultRef(value) {
this.$l_3 = value;
return value;
},
$l_3: null,
get_initialResultObject: function Srch_DataProvider$get_initialResultObject() {
var $v_0 = null;
var $v_1 = new SP.CScope('DataProvider.InitialResultObject');
$v_1.start();
if (!Srch.U.e(this.$k_3)) {
this.$1_2('InitialResultObject', 'Deserializing InitialResult json string');
try {
$v_0 = Srch.ParseJSONUtil.parseObjectFromJsonString(this.$k_3);
$v_1.stop();
return $v_0;
}
catch ($v_2) {
this.$3_2('InitialResultObject', 'Could not deserialize json string: {0} error: {1}', this.$k_3, $v_2.message);
}
}
else if (Srch.U.e(this.$k_3) && !Srch.U.e(this.$l_3) && typeof(this.$l_3) !== 'undefined') {
this.$3_2('InitialResultObject', 'Processing server generated JSON obect literal for InitialResultRef: {0}', this.$l_3);
$v_0 = eval(this.$l_3);
Srch.ParseJSONUtil.evaluateTokensInJsonObject($v_0);
return $v_0;
}
$v_1.stop();
return null;
},
get_batched: function Srch_DataProvider$get_batched() {
return this.$10_3;
},
set_batched: function Srch_DataProvider$set_batched(value) {
this.$10_3 = value;
return value;
},
$10_3: true,
get_active: function Srch_DataProvider$get_active() {
return this.$Q_3;
},
set_active: function Srch_DataProvider$set_active(value) {
this.$Q_3 = value;
return value;
},
$Q_3: true,
get_bypassResultTypes: function Srch_DataProvider$get_bypassResultTypes() {
return this.bypassResultTypes;
},
set_bypassResultTypes: function Srch_DataProvider$set_bypassResultTypes(value) {
this.bypassResultTypes = value;
return value;
},
bypassResultTypes: false,
get_processBestBets: function Srch_DataProvider$get_processBestBets() {
return this.processBestBets;
},
set_processBestBets: function Srch_DataProvider$set_processBestBets(value) {
this.processBestBets = value;
return value;
},
processBestBets: true,
get_processPersonalFavorites: function Srch_DataProvider$get_processPersonalFavorites() {
return this.$2M_3;
},
set_processPersonalFavorites: function Srch_DataProvider$set_processPersonalFavorites(value) {
this.$2M_3 = value;
return value;
},
$2M_3: true,
get_resultsPerPage: function Srch_DataProvider$get_resultsPerPage() {
return this.$x_3;
},
set_resultsPerPage: function Srch_DataProvider$set_resultsPerPage(value) {
this.$x_3 = value;
return value;
},
$x_3: 10,
get_selectedRefiners: function Srch_DataProvider$get_selectedRefiners() {
return this.$O_3;
},
set_selectedRefiners: function Srch_DataProvider$set_selectedRefiners(value) {
this.$O_3 = value;
return value;
},
$O_3: null,
get_selectedProperties: function Srch_DataProvider$get_selectedProperties() {
return this.$e_3;
},
set_selectedProperties: function Srch_DataProvider$set_selectedProperties(value) {
this.$e_3 = value;
return value;
},
$e_3: null,
get_hitHighlightedProperties: function Srch_DataProvider$get_hitHighlightedProperties() {
return this.$Y_3;
},
set_hitHighlightedProperties: function Srch_DataProvider$set_hitHighlightedProperties(value) {
this.$Y_3 = value;
return value;
},
$Y_3: null,
get_fallbackLanguage: function Srch_DataProvider$get_fallbackLanguage() {
return this.$1B_3;
},
set_fallbackLanguage: function Srch_DataProvider$set_fallbackLanguage(value) {
this.$1B_3 = value;
return value;
},
get_fallbackRankingModelID: function Srch_DataProvider$get_fallbackRankingModelID() {
return this.$1w_3;
},
set_fallbackRankingModelID: function Srch_DataProvider$set_fallbackRankingModelID(value) {
this.$1w_3 = value;
return value;
},
$1w_3: '',
get_fallbackRefinementFilters: function Srch_DataProvider$get_fallbackRefinementFilters() {
return this.$3Z_3;
},
set_fallbackRefinementFilters: function Srch_DataProvider$set_fallbackRefinementFilters(value) {
this.$3Z_3 = Srch.U.$1l(value, Srch.RefinementCategory);
return value;
},
$3Z_3: null,
get_availableSorts: function Srch_DataProvider$get_availableSorts() {
return this.$R_3;
},
set_availableSorts: function Srch_DataProvider$set_availableSorts(value) {
this.$R_3 = value;
return value;
},
$R_3: null,
get_contextualScopeUrl: function Srch_DataProvider$get_contextualScopeUrl() {
return this.$1i_3;
},
set_contextualScopeUrl: function Srch_DataProvider$set_contextualScopeUrl(value) {
this.$1i_3 = value;
return value;
},
$1i_3: '',
get_totalRows: function Srch_DataProvider$get_totalRows() {
return this.$9_3;
},
$9_3: 0,
get_rowCount: function Srch_DataProvider$get_rowCount() {
return this.$N_3;
},
$N_3: 0,
get_refinementInfo: function Srch_DataProvider$get_refinementInfo() {
return this.$u_3;
},
$u_3: null,
get_entityInfo: function Srch_DataProvider$get_entityInfo() {
return this.$U_3;
},
$U_3: null,
get_enableStemming: function Srch_DataProvider$get_enableStemming() {
return this.$1v_3;
},
set_enableStemming: function Srch_DataProvider$set_enableStemming(value) {
this.$1v_3 = value;
return value;
},
$1v_3: true,
get_enablePhonetic: function Srch_DataProvider$get_enablePhonetic() {
return this.$1t_3;
},
set_enablePhonetic: function Srch_DataProvider$set_enablePhonetic(value) {
this.$1t_3 = value;
return value;
},
$1t_3: false,
get_enableNicknames: function Srch_DataProvider$get_enableNicknames() {
return this.$1r_3;
},
set_enableNicknames: function Srch_DataProvider$set_enableNicknames(value) {
this.$1r_3 = value;
return value;
},
$1r_3: false,
get_trimDuplicates: function Srch_DataProvider$get_trimDuplicates() {
return this.$2W_3;
},
set_trimDuplicates: function Srch_DataProvider$set_trimDuplicates(value) {
this.$2W_3 = value;
return value;
},
$2W_3: true,
get_enableInterleaving: function Srch_DataProvider$get_enableInterleaving() {
return this.$1q_3;
},
set_enableInterleaving: function Srch_DataProvider$set_enableInterleaving(value) {
this.$1q_3 = value;
return value;
},
$1q_3: true,
get_enableQueryRules: function Srch_DataProvider$get_enableQueryRules() {
return this.$1u_3;
},
set_enableQueryRules: function Srch_DataProvider$set_enableQueryRules(value) {
this.$1u_3 = value;
return value;
},
$1u_3: true,
get_enableOrderingHitHighlightedProperty: function Srch_DataProvider$get_enableOrderingHitHighlightedProperty() {
return this.$1s_3;
},
set_enableOrderingHitHighlightedProperty: function Srch_DataProvider$set_enableOrderingHitHighlightedProperty(value) {
this.$1s_3 = value;
return value;
},
$1s_3: false,
get_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$get_hitHighlightedMultivaluePropertyLimit() {
return this.$1G_3;
},
set_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$set_hitHighlightedMultivaluePropertyLimit(value) {
this.$1G_3 = value;
return value;
},
get_properties: function Srch_DataProvider$get_properties() {
if (!this.$27_3) {
this.$27_3 = {};
}
return this.$27_3;
},
set_properties: function Srch_DataProvider$set_properties(value) {
this.$27_3 = value;
return value;
},
$27_3: null,
get_clientType: function Srch_DataProvider$get_clientType() {
return this.$2e_3;
},
set_clientType: function Srch_DataProvider$set_clientType(value) {
this.$2e_3 = value;
return value;
},
$2e_3: '',
get_maxPagesAfterCurrent: function Srch_DataProvider$get_maxPagesAfterCurrent() {
return this.$o_3;
},
set_maxPagesAfterCurrent: function Srch_DataProvider$set_maxPagesAfterCurrent(value) {
this.$o_3 = value;
return value;
},
$o_3: 0,
get_userAction: function Srch_DataProvider$get_userAction() {
return this.$P_3;
},
set_userAction: function Srch_DataProvider$set_userAction(value) {
this.$P_3 = value;
return value;
},
get_queryCount: function Srch_DataProvider$get_queryCount() {
return this.$2I_3;
},
set_queryCount: function Srch_DataProvider$set_queryCount(value) {
this.$2I_3 = value;
return value;
},
$2I_3: 0,
get_resultsUrl: function Srch_DataProvider$get_resultsUrl() {
if (!this.$3D_3) {
return ajaxNavigate.get_href();
}
return this.$3D_3;
},
set_resultsUrl: function Srch_DataProvider$set_resultsUrl(value) {
this.$3D_3 = value;
return value;
},
$3D_3: null,
get_upScopeUrl: function Srch_DataProvider$get_upScopeUrl() {
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() {
var $v_0 = -1;
var $v_1 = '';
if ($v_0 < 1 && this.$1B_3 > 0) {
$v_0 = this.$1B_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() {
return Srch.ScriptApplicationManager.get_current().getDisplayNameByLanguageID(this.get_effectiveQueryLanguage());
},
get_$4r_3: function Srch_DataProvider$get_$4r_3() {
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.$R_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.$1x_3)) {
$v_0 = this.$1x_3;
$v_1 = 'Using fall back sorts...';
}
this.$1_2('GetSorts', $v_1);
return $v_0;
},
get_parentImpressionID: function Srch_DataProvider$get_parentImpressionID() {
return this.$1Q_3;
},
set_parentImpressionID: function Srch_DataProvider$set_parentImpressionID(value) {
this.$1Q_3 = value;
return value;
},
$1Q_3: null,
get_updateAjaxNavigate: function Srch_DataProvider$get_updateAjaxNavigate() {
return this.$2Y_3;
},
set_updateAjaxNavigate: function Srch_DataProvider$set_updateAjaxNavigate(value) {
this.$2Y_3 = value;
return value;
},
$2Y_3: true,
get_summaryLength: function Srch_DataProvider$get_summaryLength() {
return this.$2V_3;
},
set_summaryLength: function Srch_DataProvider$set_summaryLength(value) {
this.$2V_3 = value;
return value;
},
$2V_3: 180,
get_desiredSnippetLength: function Srch_DataProvider$get_desiredSnippetLength() {
return this.$1m_3;
},
set_desiredSnippetLength: function Srch_DataProvider$set_desiredSnippetLength(value) {
this.$1m_3 = value;
return value;
},
$1m_3: 90,
get_personalizedQuery: function Srch_DataProvider$get_personalizedQuery() {
return this.$2x_3;
},
set_personalizedQuery: function Srch_DataProvider$set_personalizedQuery(value) {
this.$2x_3 = value;
return value;
},
$2x_3: false,
get_timeZoneId: function Srch_DataProvider$get_timeZoneId() {
return this.$1f_3;
},
set_timeZoneId: function Srch_DataProvider$set_timeZoneId(value) {
this.$1f_3 = value;
return value;
},
initialize: function Srch_DataProvider$initialize() {
if (this.$Q_3) {
this.$y_3 = this.$$d_$4W_3;
ajaxNavigate.add_na