Difference between revisions of "MediaWiki:Common.js"

From dataZoa Wiki
Jump to: navigation, search
 
(95 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
//the below does work!!
+
/* Usage: default TOC to collaped: <div class="collapseTOC">__TOC__</div> */
$(document).ready(function(){
+
$('.collapseTOC .toctoggle #togglelink').click()
$("h2").click(function(){
+
alert("The h2 was clicked.");
+
});
+
});
+
  
//basic function, wrapped in document.ready -- this works!
+
/* Global overrides for styling */
function thisAlert() {$(document).ready(function(){
+
$('body').addClass('GbcWIKI');
alert('this is an alert');
+
$('#mw-head').addClass('GbcWIKI');
});
+
$('#mw-panel').addClass('Gfwb');
}
+
  
//function triggered by the presence of a particular id
 
$(document).ready(function() {
 
if($('#mylist').length > 0) {
 
alert('yes')
 
};
 
});
 
  
//internal load function => this ultimately does not work because I can't call the function
 
function testLoad() {$(document).ready(function(){
 
$.ajax({
 
    url:'http://docwiki.datazoa.com/Test_Origin_Text',
 
    type:'get',
 
    dataType:'html',
 
    success:function(data) {
 
        alert('testLoad was successful!');}
 
    })
 
});
 
}
 
  
//modified internal load, triggered by an id (as above)
+
$('#mw-head').height('80px'); // horrible temporary kludge for chrome
$(document).ready(function() {
+
if($('#loadfunction').length > 0) {
+
$.ajax({
+
    url:'http://docwiki.datazoa.com/Test_Origin_Text',
+
    type:'get',
+
    dataType:'html',
+
    success:function(data) {
+
        alert('testLoad was successful!');}
+
    })
+
};
+
});
+
  
//internal load with full script
+
$('#mw-page-base').addClass('GbcWIKI')
$(document).ready(function() {
+
$('#mw-head-base').addClass('GbcWIKI')
if($('#myList').length > 0) {
+
$.ajax({
+
    url:'http://docwiki.datazoa.com/Test_Origin_Text',
+
    type:'get',
+
    dataType:'html',
+
    success:function(data) {
+
        var _html= jQuery(data);
+
        list = _html.find('li'); // gets me an object (maybe?) with four elements
+
      for (i = 0; i <= list.length; i++) {
+
        console.log(list[i].innerHTML); //I get an error on HTML but it still seems to output correctly
+
            var node = document.createElement("li"); // create a <li> node
+
        var textnode = document.createTextNode(list[i].innerHTML); //create a text node
+
        node.appendChild(textnode); // append text to li
+
        document.getElementById("myList").appendChild(node); // append li to ul with id="myList"
+
}
+
                                        }
+
    })
+
};
+
});
+
 
+
//external load with full script -- still showing an error on list . . .
+
$(document).ready(function() {
+
if($('#externalList').length > 0) {
+
$.ajax({
+
    url:'https://www.datazoa.com/publish/gettingdata-01-1.asp',
+
    type:'get',
+
    dataType:'html',
+
    success:function(data) {
+
        var _html= jQuery(data);
+
        list = _html.find('Gdib GCfl'); // gets me an object (maybe?) with four elements
+
      for (i = 0; i <= list.length; i++) {
+
        console.log(list[i].innerHTML); //I get an error on HTML but it still seems to output correctly
+
            var node = document.createElement("li"); // create a <li> node
+
        var textnode = document.createTextNode(list[i].innerHTML); //create a text node
+
        node.appendChild(textnode); // append text to li
+
        document.getElementById("externalList").appendChild(node); // append li to ul with id="externalList"
+
}
+
                                        }
+
    })
+
};
+
});
+
 
+
//external load function, simplified, with trigger
+
$(document).ready(function() {
+
if($('#externalList').length > 0) {
+
$.ajax({
+
    url:'https://www.datazoa.com/publish/gettingdata-01-1.asp',
+
    type:'get',
+
    dataType:'html',
+
    success:function(data) {
+
        alert('externaltLoad was successful!');}
+
    })
+
};
+
});
+
  
 +
/* stop wasting space */
 +
$('#editpage-copywarn').hide();
 +
$('.mw-editinginterface').hide();
 +
$('.mw-translateinterface').hide();
 +
$('#wpSummaryLabel').hide();
 +
$('#wpSummary').hide();
 +
$('#editCheckBoxes').hide();
  
 
//external load function -- this does not work, comes up as undefined, etc.
 
function extLoad() {$(document).ready(function(){
 
$.ajax({
 
    url:'https://www.datazoa.com/publish/gettingdata-01-1.asp',
 
    type:'get',
 
    dataType:'html',
 
    success:function(data) {
 
        alert('extLoad was successful!');}
 
    })
 
});
 
}
 
 
// script for loading gettingdata-01-1.asp
 
$(document).ready(function() {
 
if($('#gettingdata-01-1').length > 0) {
 
$.ajax({
 
    url:'https://www.datazoa.com/publish/gettingdata-01-1.asp',
 
    type:'get',
 
    dataType:'html',
 
    success:function(data) {
 
_html= jQuery(data);
 
        titles = _html.find('.Gdib.GCfl');
 
expression = /http\S+?\"/
 
patt = new RegExp(expression);
 
//titles = $(".Gdib.GCfl");
 
for (i = 2; i < 33; i ++) {
 
  title = titles[i].innerHTML;
 
                link = titles[i].getAttribute('onclick');
 
  if(title) {
 
                if(title.includes('img')){
 
  //console.log("skip this line");
 
  }
 
  else {
 
  console.log(title);
 
                title = title.replace("&amp;","&");
 
                res = patt.exec(link);
 
                res = String(res).replace("\"","");
 
  var node = document.createElement("li"); // create a <li> node
 
                var textnode = document.createElement("a");
 
                textnode.setAttribute('href', res);
 
                //textnode.setAttribute('title', title);
 
                textnode.innerHTML = title;
 
    //var textnode = document.createTextNode("[" + res + " " + title + "]"); //create a text node
 
//var textnode = document.createTextNode("<a href=\"" + res + "\">" + title + "</a>"); //create a text node
 
        node.appendChild(textnode); // append text to li
 
document.getElementById("gettingdata-01-1").appendChild(node); // append li to ul with id="myList"
 
  }
 
}
 
        //alert('externalLoad was successful!');
 
}
 
}
 
    })
 
};
 
});
 
  
 
// js for changing the image
 
// js for changing the image
  
if($('.changeimage')) {
+
if($('.changeimage').length > 0) {
image = $('.changeimage');
+
var image = $('.changeimage');
 
image = image[0];
 
image = image[0];
 
image.style.background = "url(https://www.datazoa.com/img/vert_data_table.png)";   
 
image.style.background = "url(https://www.datazoa.com/img/vert_data_table.png)";   
Line 172: Line 37:
 
}
 
}
  
// js for imgSnippet
+
// Load images from OUTSIDE the wiki -- needs some kludges...
// Model: <div class="imgSnippet " data-styler="{ view: 'nnn', style: 'sss'  }"></div>
+
 
// Replace nnn and sss with a View number and style string from Decorator.asp
+
// js for imgSnippet (show a shifted part of a foreign image)
//var g_althost = ''; // set to e.g. https://www.datahydra.com
+
// Model: <div class="imgSnippetWrap1"><div class="imgSnippet " data-styler="{ view: nnn, styler: '...stylestr...'  }"></div></div>
var g_althost = 'https://www.datahydra.com';
+
// Copy the View string from Decorator.asp
 +
var g_althost = 'https://www.datazoa.com'; // set to e.g. http://www.datahydra.com
 +
//var g_althost = 'http://www.datahydra.com';
 
$('.imgSnippet').each( function() {
 
$('.imgSnippet').each( function() {
 
var elem = $(this);
 
var elem = $(this);
Line 182: Line 49:
 
elem.attr('style', styler.style.replace(/SQ/g,"'").replace('/img/DocSamples',g_althost+'/img/DocSamples'));
 
elem.attr('style', styler.style.replace(/SQ/g,"'").replace('/img/DocSamples',g_althost+'/img/DocSamples'));
 
elem.addClass( 'decoratorView' + styler.view);
 
elem.addClass( 'decoratorView' + styler.view);
if ( '' != g_althost ) { elem.text(g_althost); } // watermark reminder when under development
+
 +
// watermark reminder when under development
 +
if ( g_althost.toLowerCase().indexOf('datazoa.com') < 0 ) { elem.text('    ' + g_althost); elem.css('color','orange'); elem.css('font-weight','bold'); elem.css('font-size','xx-small'); }  
 
});
 
});
 +
 +
 +
// workhorse for imgWhole, loads a foreign image (after page load, to avoid MediaWiki limitation)
 +
// for elem, takes an attr called data-guts, which is a string that evals to an object, slaps it into the elem itself
 +
imgWholeFunc = function( elem, scrollOpt ) {
 +
if ( undefined === elem.attr('style') ) { elem.attr('style',''); } // assert a style attr
 +
eval( "var guts = " + elem.data('guts')); // get the string for attr data-guts
 +
if ( undefined !== guts ) {
 +
elem.attr('title', guts.title);
 +
elem.attr('style', elem.attr('style') + ' ' + 'background: transparent url(' + g_imgWholeHost + guts.url + ') scroll 0 0;  background-repeat: no-repeat; ');
 +
elem.attr('style', elem.attr('style') + ' ' + guts.xtraStyle);
 +
}
 +
}
 +
 +
 +
// Model: <div class="imgWholeWrap1"><div class="imgWhole " data-guts="{ url: '...', xtraStyle: '...stylestr...'  }"></div></div>
 +
// example to insert an icon from dataZoa.com:
 +
// <div class="imgWholeWrap1"><div class="imgWhole " data-guts="{ url: '/img/Hint.png', title: 'Hint example', xtraStyle: ' min-height: 16px; min-width: 16px;'  }"></div></div>
 +
 +
var g_imgWholeHost = "https://www.datazoa.com" // where are the images from?
 +
 +
// generic
 +
$('.imgWhole').each( function() { imgWholeFunc($(this)); });
 +
$('.pageSnippet').each( function() { pageSnippetFunc($(this)); });
 +
 +
// for imgGlyph24 class
 +
// e.g. <div class="imgGlyph24 imgIdea"></div> to insert a lightbulb
 +
//
 +
$('.imgIdea').each( function() { $(this).attr("data-guts","{ url: '/img/3_idea24.png', title: 'A tip for you...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgWarning').each( function() { $(this).attr("data-guts","{ url: '/img/58_warn24.png', title: 'Warning!', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgConcept').each( function() { $(this).attr("data-guts","{ url: '/img/81_BlueFlag24.png', title: 'Important Concept...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgHowTo').each( function() { $(this).attr("data-guts","{ url: '/img/79_GreenFlag24.png', title: 'How to...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgDisambiguate').each( function() { $(this).attr("data-guts","{ url: '/img/80_YellowFlag24.png', title: 'Disambiguate...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgNote').each( function() { $(this).attr("data-guts","{ url: '/img/80_YellowFlag24.png', title: 'Note...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
 +
$('.imgCellYes').each( function() { $(this).attr("data-guts","{ url: '/img/Apply.png', title: 'Yes', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgCellNo').each( function() { $(this).attr("data-guts","{ url: '/img/Erase.png', title: 'No', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgCellMaybe').each( function() { $(this).attr("data-guts","{ url: '/img/Apply_grey.png', title: 'Maybe', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgKeyTip').each( function() { $(this).attr("data-guts","{ url: '/img/Key24.png', title: 'Key Tip', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgDZDot').each( function() { $(this).attr("data-guts","{ url: '/img/dZ-Dot.png', title: 'dZ-Dot', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
 +
$('.imgExport').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Download-Dark.png', title: 'Export', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgEmbed').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Embed-Dark.png', title: 'Embed Link', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgShare').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Share-Dark.png', title: 'Social Media Sharing', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgEmail').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Email-Dark.png', title: 'Email', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgSMS').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-SMS-Dark.png', title: 'SMS', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgMirror').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Mirror-Dark.png', title: 'dZ-Mirror', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgFollow').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Follow-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgPrint').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-PDF-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgSnapshot').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-PNG-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
 +
$('.imgLock').each( function() { $(this).attr("data-guts","{ url: '/img/lock.png', title: 'Private', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgGlobe').each( function() { $(this).attr("data-guts","{ url: '/img/globe.png', title: 'Public', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgShareable').each( function() { $(this).attr("data-guts","{ url: '/img/shareable.png', title: 'Shareable', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
$('.imgPeople').each( function() { $(this).attr("data-guts","{ url: '/img/people.png', title: 'Shared', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
 +
$('.imgFormula').each( function() { $(this).attr("data-guts","{ url: '/img/Retort.png', title: 'Formula', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 +
 +
/* button to return to dz if we came from there */
 +
$('#firstHeading').append('<div style="display: inline-block; position: relative; float: right;"><div class="backToOpener HPButton2 DZGreenBut2" style="display: inline-block;font-style: normal;">Back to dataZoa</div></div>');
 +
$('.backToOpener').each( function() { if( !window.opener || window.opener.closed ) { $(this).hide(); } else { $(this).attr("onclick","window.opener.postMessage('pleaseAlert','*');"); } });
 +
 +
 +
 +
// V22 messaging between certain browser windows
 +
// e.g. from docwiki: window.opener.postMessage('pleaseFocus','*');
 +
//
 +
var DZCompanions = new Object;
 +
 +
DZCompanions.listen = function() {
 +
 +
window.addEventListener("message", DZCompanions.receiveMessage, false );
 +
}
 +
 +
DZCompanions.receiveMessage = function( evt ) {
 +
 +
var origin = evt.origin || evt.originalEvent.origin; // For Chrome, the origin property is in the event.originalEvent object.
 +
 +
console.log( 'receiver origin ' + origin );
 +
console.log( 'receiver Evt.data ' + evt.data );
 +
 +
// try both protocols
 +
if ( undefined == DZCompanions.acceptedOrigins[origin] ) {
 +
origin = origin.replace('http://','https://');
 +
}
 +
 +
if ( undefined !== DZCompanions.acceptedOrigins[origin] ) {
 +
DZCompanions.acceptedOrigins[origin].handler( evt );
 +
}
 +
}
 +
 +
DZCompanions.standardHandler = function( evt ) {
 +
 +
// console.log( 'handler Evt.data ' + evt.data );
 +
 +
switch ( evt.data ) {
 +
case 'pleaseFocus':
 +
window.focus();
 +
break;
 +
 +
case 'pleaseBlinkTitle':
 +
blinkWindowTitle( window, 200, 6 );
 +
break;
 +
 +
case 'pleaseAlert':
 +
alert('...and we\'re back!');
 +
break;
 +
 +
default:
 +
window.location.href = evt.data;
 +
break;
 +
}
 +
return;
 +
}
 +
 +
DZCompanions.acceptedOrigins = {
 +
'https://docwiki.datazoa.com':{nickname:'docwiki', handler: DZCompanions.standardHandler, desc: 'dataZoa Documentation Wiki' },
 +
'https://guides.datazoa.com':{nickname:'guides', handler: DZCompanions.standardHandler, desc: 'dataZoa Guide on the Side' },
 +
'https://www.datazoa.com':{nickname:'dataZoa', handler: DZCompanions.standardHandler, desc: 'dataZoa' },
 +
'https://www.datahydra.com':{nickname:'dataHydra', handler: DZCompanions.standardHandler, desc: 'dataHydra' }
 +
};
 +
 +
/* hide ridiculous search results TMI */
 +
$('.mw-search-result-data').hide();
 +
$('.searchresult').html('<i style="opacity: 0;">.</i>').css('height','0');
 +
$('ul.mw-search-results li').css('padding-bottom','0');
 +
$('.searchresults .mw-search-createlink').hide();
 +
$('.mw-search-profile-tabs').hide();
 +
$('#mw-searchoptions').hide();
 +
$('.mw-search-results').css('min-height', '10em');

Latest revision as of 09:16, 26 April 2017

/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Usage: default TOC to collaped: <div class="collapseTOC">__TOC__</div> */
$('.collapseTOC .toctoggle #togglelink').click()
 
/* Global overrides for styling */
$('body').addClass('GbcWIKI');
$('#mw-head').addClass('GbcWIKI');
$('#mw-panel').addClass('Gfwb');
 
 
 
$('#mw-head').height('80px'); // horrible temporary kludge for chrome
 
$('#mw-page-base').addClass('GbcWIKI')
$('#mw-head-base').addClass('GbcWIKI')
 
/* stop wasting space */
$('#editpage-copywarn').hide();
$('.mw-editinginterface').hide();
$('.mw-translateinterface').hide();
$('#wpSummaryLabel').hide();
$('#wpSummary').hide();
$('#editCheckBoxes').hide();
 
 
// js for changing the image
 
if($('.changeimage').length > 0) {
var image = $('.changeimage');
image = image[0];
image.style.background = "url(https://www.datazoa.com/img/vert_data_table.png)";  
image.style.backgroundPosition = "0px 0px"; //change the first number for horizontal positioning, the second number for vertical 
image.style.backgroundRepeat = "no-repeat";
image.style.width = "600px";
image.style.height = "200px";
}
 
// Load images from OUTSIDE the wiki -- needs some kludges...
 
// js for imgSnippet (show a shifted part of a foreign image)
// Model: <div class="imgSnippetWrap1"><div class="imgSnippet " data-styler="{ view: nnn, styler: '...stylestr...'  }"></div></div>
// Copy the View string from Decorator.asp
var g_althost = 'https://www.datazoa.com'; // set to e.g. http://www.datahydra.com
//var g_althost = 'http://www.datahydra.com';
$('.imgSnippet').each( function() {
	var elem = $(this);
	eval( "var styler = " + elem.data('styler'));
	elem.attr('style', styler.style.replace(/SQ/g,"'").replace('/img/DocSamples',g_althost+'/img/DocSamples'));
	elem.addClass( 'decoratorView' + styler.view);
 
	// watermark reminder when under development
	if ( g_althost.toLowerCase().indexOf('datazoa.com') < 0 ) { elem.text('     ' + g_althost); elem.css('color','orange'); elem.css('font-weight','bold'); elem.css('font-size','xx-small'); } 
});
 
 
// workhorse for imgWhole, loads a foreign image (after page load, to avoid MediaWiki limitation)
// for elem, takes an attr called data-guts, which is a string that evals to an object, slaps it into the elem itself 
imgWholeFunc = function( elem, scrollOpt ) {
	if ( undefined === elem.attr('style') ) { elem.attr('style',''); } // assert a style attr
	eval( "var guts = " + elem.data('guts')); // get the string for attr data-guts
	if ( undefined !== guts ) {
		elem.attr('title', guts.title);
		elem.attr('style', elem.attr('style') + ' ' + 'background: transparent url(' + g_imgWholeHost + guts.url + ') scroll 0 0;  background-repeat: no-repeat; ');
		elem.attr('style', elem.attr('style') + ' ' + guts.xtraStyle);
	}
}
 
 
// Model: <div class="imgWholeWrap1"><div class="imgWhole " data-guts="{ url: '...', xtraStyle: '...stylestr...'  }"></div></div>
// example to insert an icon from dataZoa.com: 
// <div class="imgWholeWrap1"><div class="imgWhole " data-guts="{ url: '/img/Hint.png', title: 'Hint example', xtraStyle: ' min-height: 16px; min-width: 16px;'  }"></div></div>
 
var g_imgWholeHost = "https://www.datazoa.com" // where are the images from?
 
// generic
$('.imgWhole').each( function() { imgWholeFunc($(this)); });
$('.pageSnippet').each( function() { pageSnippetFunc($(this)); });
 
// for imgGlyph24 class 
// e.g. <div class="imgGlyph24 imgIdea"></div> to insert a lightbulb
//
$('.imgIdea').each( function() { $(this).attr("data-guts","{ url: '/img/3_idea24.png', title: 'A tip for you...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgWarning').each( function() { $(this).attr("data-guts","{ url: '/img/58_warn24.png', title: 'Warning!', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgConcept').each( function() { $(this).attr("data-guts","{ url: '/img/81_BlueFlag24.png', title: 'Important Concept...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgHowTo').each( function() { $(this).attr("data-guts","{ url: '/img/79_GreenFlag24.png', title: 'How to...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgDisambiguate').each( function() { $(this).attr("data-guts","{ url: '/img/80_YellowFlag24.png', title: 'Disambiguate...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgNote').each( function() { $(this).attr("data-guts","{ url: '/img/80_YellowFlag24.png', title: 'Note...', xtraStyle: '' }"); imgWholeFunc( $(this) ); });
$('.imgCellYes').each( function() { $(this).attr("data-guts","{ url: '/img/Apply.png', title: 'Yes', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgCellNo').each( function() { $(this).attr("data-guts","{ url: '/img/Erase.png', title: 'No', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgCellMaybe').each( function() { $(this).attr("data-guts","{ url: '/img/Apply_grey.png', title: 'Maybe', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgKeyTip').each( function() { $(this).attr("data-guts","{ url: '/img/Key24.png', title: 'Key Tip', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgDZDot').each( function() { $(this).attr("data-guts","{ url: '/img/dZ-Dot.png', title: 'dZ-Dot', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 
$('.imgExport').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Download-Dark.png', title: 'Export', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgEmbed').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Embed-Dark.png', title: 'Embed Link', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgShare').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Share-Dark.png', title: 'Social Media Sharing', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgEmail').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Email-Dark.png', title: 'Email', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgSMS').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-SMS-Dark.png', title: 'SMS', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgMirror').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Mirror-Dark.png', title: 'dZ-Mirror', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgFollow').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-Follow-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgPrint').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-PDF-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgSnapshot').each( function() { $(this).attr("data-guts","{ url: '/img/EMCT-PNG-Dark.png', title: 'Print', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 
$('.imgLock').each( function() { $(this).attr("data-guts","{ url: '/img/lock.png', title: 'Private', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgGlobe').each( function() { $(this).attr("data-guts","{ url: '/img/globe.png', title: 'Public', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgShareable').each( function() { $(this).attr("data-guts","{ url: '/img/shareable.png', title: 'Shareable', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
$('.imgPeople').each( function() { $(this).attr("data-guts","{ url: '/img/people.png', title: 'Shared', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 
$('.imgFormula').each( function() { $(this).attr("data-guts","{ url: '/img/Retort.png', title: 'Formula', xtraStyle: ' background-position: center; ' }"); imgWholeFunc( $(this) ); });
 
/* button to return to dz if we came from there */
$('#firstHeading').append('<div style="display: inline-block; position: relative; float: right;"><div class="backToOpener HPButton2 DZGreenBut2" style="display: inline-block;font-style: normal;">Back to dataZoa</div></div>');
$('.backToOpener').each( function() { if( !window.opener || window.opener.closed ) { $(this).hide(); } else { $(this).attr("onclick","window.opener.postMessage('pleaseAlert','*');"); } });
 
 
 
// V22 messaging between certain browser windows
// e.g. from docwiki: window.opener.postMessage('pleaseFocus','*');
//
var DZCompanions = new Object;
 
DZCompanions.listen = function() {
 
	window.addEventListener("message", DZCompanions.receiveMessage, false );
}
 
DZCompanions.receiveMessage = function( evt ) {
 
	var origin = evt.origin || evt.originalEvent.origin; // For Chrome, the origin property is in the event.originalEvent object.
 
	console.log( 'receiver origin ' + origin );
	console.log( 'receiver Evt.data ' + evt.data );
 
	// try both protocols
	if ( undefined == DZCompanions.acceptedOrigins[origin] ) {
		origin = origin.replace('http://','https://');
	}
 
	if ( undefined !== DZCompanions.acceptedOrigins[origin] ) {
		DZCompanions.acceptedOrigins[origin].handler( evt );
	}
}
 
DZCompanions.standardHandler = function( evt ) {
 
	// console.log( 'handler Evt.data ' + evt.data );
 
	switch ( evt.data ) {
	case 'pleaseFocus': 
		window.focus();
		break;
 
	case 'pleaseBlinkTitle': 
		blinkWindowTitle( window, 200, 6 );
		break;
 
	case 'pleaseAlert': 
		alert('...and we\'re back!');
		break;
 
	default:
window.location.href = evt.data;
		break;
	}
	return;
}
 
DZCompanions.acceptedOrigins = {
	'https://docwiki.datazoa.com':{nickname:'docwiki', handler: DZCompanions.standardHandler, desc: 'dataZoa Documentation Wiki' },
	'https://guides.datazoa.com':{nickname:'guides', handler: DZCompanions.standardHandler, desc: 'dataZoa Guide on the Side' },	
	'https://www.datazoa.com':{nickname:'dataZoa', handler: DZCompanions.standardHandler, desc: 'dataZoa' },
	'https://www.datahydra.com':{nickname:'dataHydra', handler: DZCompanions.standardHandler, desc: 'dataHydra' }	
};
 
/* hide ridiculous search results TMI */
$('.mw-search-result-data').hide();
$('.searchresult').html('<i style="opacity: 0;">.</i>').css('height','0');
$('ul.mw-search-results li').css('padding-bottom','0');
$('.searchresults .mw-search-createlink').hide();
$('.mw-search-profile-tabs').hide();
$('#mw-searchoptions').hide();
$('.mw-search-results').css('min-height', '10em');