/*
This is the standard template you should add to your book JS file before
customizing.
Uncomment any of the configuration options to change the default behavior (see
https://macmillanhighered.atlassian.net/wiki/display/MP/Player+Configuration+Options
for descriptions of the options).
*/
(function($) {
$.fn.changeElementType = function(newType) {
var attrs = {};
$.each(this[0].attributes, function(idx, attr) {
attrs[attr.nodeName] = attr.nodeValue;
});
this.replaceWith(function() {
return $("<" + newType + "/>", attrs).append($(this).contents());
});
};
})(jQuery);
xBookUtils.printDebugStatements = "on";
/**************************************
Set this to the DF book ID (Subtype)
**************************************/
xBookUtils.bookID = "realcomm3e";
/*
You only need to set the disciplines if you are using the HTML Quiz
question delivery method, which only BSM ebooks are at this time
(in other words, if this is a FW ebook then you don't need to do a thing).
Change the zeros to the discipline number for each tier on PX.
Discipline numbers:
History: 6696 (all tiers)
Composition: 6698 (all tiers)
Communication: 6700 (all tiers)
College Success: 6704 (all tiers)
*/
xBookUtils.discipline = {
dev: 6700,
qa: 6700,
pr: 6700,
www: 6700
}
var Player_subtype = Player_manuscript_type.extend({
//cfg_removeRawHtmlDivs: "on",
cfg_showAnswer: "on",
//cfg_showAnswerAutoWrapThis: "off",
cfg_Box_moveTitle: "real_comm",
//cfg_Box_moveTitleExclude: "",
//cfg_Figures_targetDefault: "_blank",
//cfg_Figures_resizeDivWidth: "off",
cfg_Figures_autoHtml: "on",
cfg_LH_autoHtml: "on",
//cfg_LH_externalTargetDefault: "_pop",
//cfg_LH_internalTargetDefault: "_pop",
//cfg_LH_ebookTargetDefault: "_pop",
//cfg_LH_imageTargetDefault: "_blank",
cfg_LH_useOpenContent: "on",
cfg_LH_useLinksFile: "on",
cfg_Glossary_hoverTerms: "on",
cfg_Glossary_useStickyDiv: "on",
//cfg_Glossary_hoverTermsNoClick: "",
initialize_sections: function() {
// Do not delete this
this._super();
// Anything that needs to be done before the page displays
// should be done here.
}, // end initialize_sections
/*
You will most likely not make any changes to the initialize
method unless you know exactly what you are doing :-)
*/
initialize: function(id) {
// Do not delete this
this._super(id);
this.xrefs = new XRefs_manuscript_subtype();
this.glossary = new Glossary_manuscript_subtype();
this.figures = new Figures_manuscript_subtype();
}, // end initialize
initialize2: function() {
// Do not delete this
this._super();
var link_handler = new LinkHandler();
// Anything that can be done after the page displays
// should be done here.
$('[data-block_type="box_plain"] h3[data-type="title"]').each(function() {
var $this = $(this);
var $box = $this.parent().parent();
$this.addClass("box_plain_title");
var title = $this.html();
title = title.replace(/(BOX [AB\d+]\.\d+)/, "$1");
$this.html(title);
$this.insertBefore($box);
});
$('[data-block_type="WFC"] h3[data-type="title"]').each(function() {
var $this = $(this);
$this.html("WIREDFORCOMMUNICATION");
});
$('[data-block_type="ECE"] h3[data-type="title"]').each(function() {
var $this = $(this);
$this.html("EVALUATINGCOMMUNICATIONETHICS");
});
$('[data-block_type="CAC"] h3[data-type="title"]').each(function() {
var $this = $(this);
$this.html("COMMUNICATIONACROSSCULTURES");
});
$('[data-block_type="box_plain"] [data-block_type="box_src"]').each(function() {
var $this = $(this);
var $box = $this.parent().parent();
$this.insertAfter($box);
});
$('[data-type="table_caption"] [data-block_type="table_src"]').each(function() {
var $this = $(this);
var $table = $this.parent().parent().siblings("table");
$this.insertAfter($table);
});
// Add "Click here" link for tables
if ($('#supp_win').length == 0) {
$('[data-block_type="table_num"]').each(function() {
var $this = $(this);
var $table = $this.parent().parent().parent().parent().parent();
var num = $this.text();
var match = num.match(/TABLE (\d+)\.(\d+)/);
if (match !== null) {
$table.after("
[Click here to open Table " + match[1] + "." + match[2] + " in a supplemental window]
");
}
});
}
$('[data-block_type="box_src"]').each(function() {
var $this = $(this);
var $box = $this.parent().parent();
$this.insertAfter($table);
});
$('[data-block_type="TTT"] h2.section-title').each(function() {
var $this = $(this);
var title = $this.html();
title = title.replace(/Things to Try: /, "");
$this.html(title);
});
$('[data-block_type="RR"] h2.section-title').each(function() {
var $this = $(this);
var title = $this.html();
title = title.replace(/Real Reference: /, "");
$this.html(title);
});
$('[data-block_type="chap_intro"] h2.section-title').each(function() {
var $this = $(this);
var chap_num = xBookUtils.getChapter();
if (chap_num < 100) {
$this.before("" + chap_num + "
");
if (chap_num > 9) {
$('#manuscript').addClass("plus10");
}
}
else {
if (chap_num == 201) {
chap_num = "A";
}
else if (chap_num == 202) {
chap_num = "B";
}
$this.before("" + chap_num + "
");
}
});
$('[data-sec-id="realcomm3e_ch15-sec3-011-ssis"] h2.section-title').each(function() {
var $this = $(this);
var title = $this.text();
title = title.replace(/:.*/, "");
$this.text(title);
});
$('[data-sec-id="realcomm3e_ch16-sec2-014-ssps"] h2.section-title').each(function() {
var $this = $(this);
var title = $this.text();
title = title.replace(/:.*/, "");
$this.text(title);
});
$('[data-sec-id="realcomm3e_ch201_chap_intro"] h2.section-title span').each(function() {
var $this = $(this);
var title = $this.text();
title = title.replace(/^[^:]+:/, "");
$this.text(title);
});
$('[data-sec-id="realcomm3e_ch202_chap_intro"] h2.section-title span').each(function() {
var $this = $(this);
var title = $this.text();
title = title.replace(/^[^:]+:/, "");
$this.text(title);
});
$('[data-type="termref"]').each(function() {
var $this = $(this);
var term = $this.attr('data-term');
if (xBookUtils.emptyValue(term)) {
term = $this.html();
}
var timer_id = setInterval(function() {
if (xBookUtils.terms['zzz_end'] !== undefined) {
var term_entry = player.glossary.get_entry(term);
if (term_entry === undefined) {
safe_log("termref: [" + term + "] is missing from xBookUtils.terms (" + term_entry + ")");
$this.addClass("missing");
}
clearInterval(timer_id);
}
}, 100);
});
var has_questions = $('[data-type="question"]').length;
safe_log("has_questions: " + has_questions);
// Make transcript/commentarty links accessible
$('[data-block_type^="doc:"]').each(function() {
var $this = $(this);
var file_path = $this.attr('data-block_type').replace(/doc:/, "");
var target = file_path.replace(/.*\/([^/]+)/,"$1")
.replace(/\.html?/,"").toLowerCase();
$this.attr("href",file_path).attr('target', target);
var link_text = $this.text();
if (link_text.match(/Transcript/i)) {
link_text = link_text.replace(/Transcript/, "transcript");
/*
link_text = link_text.replace(/transcript/,
"transcript");
*/
}
else {
link_text = link_text.replace(/Commentary/, "commentary");
/*
link_text = link_text.replace(/commentary/,
"commentary");
*/
}
link_text += ' (Opens in new window)';
$this.html(link_text);
$this.changeElementType("a");
});
$('#transVideo > p > a').each(function() {
var $this = $(this);
var html = $this.html();
$this.html(html + ' (Opens in new window)');
});
$('a').each(function() {
var $this = $(this);
var href = $this.attr('href');
if (/\.xml$/.test(href) || xBookUtils.emptyValue(href)) {
var px = $this.attr('data-href-px');
var alias = $this.attr('data-href-alias');
if (xBookUtils.emptyValue(px) && xBookUtils.emptyValue(alias)) {
$this.attr('target', '_disable');
$this.attr('data-xrefs-target', '0');
}
}
else if (has_questions) {
if (xBookUtils.ebookPage(href)) {
$this.attr('target', '_pop');
$this.attr('data-xrefs-target', '0');
}
}
});
$('.question_action_div').find('input').each(function() {
var $input = $(this);
$input.wrap('');
});
lineUpMarginText();
var linksInt = setInterval(function() {
if ("yyy_end" in xBookUtils.links) {
clearInterval(linksInt);
$('[data-type="termref"], [data-video], [data-block_type="video"]').each(function() {
var $this = $(this);
var term = $this.text();
term = term.toLowerCase();
var video = $this.attr('data-video');
if (!xBookUtils.emptyValue(video)) {
term = video;
safe_log("setting term from [" + term + "] to [" + video + "]");
}
if (term in xBookUtils.links) {
$this.after("");
$this.addClass('video');
}
});
$('a[data-video]').each(function() {
var $this = $(this);
var term = $this.attr('data-video');
if (term in xBookUtils.links) {
//$this.after("");
$this.attr('href', "alias:" + term);
$this.attr('target', "_ebook");
$this.attr('title', "Watch Video");
var html = $this.html();
$this.html(html + "");
}
});
}
}, 100);
} // end initialize2
}); // end Player_subtype
// Do not delete this
player = new Player_subtype();
function lineUpMarginText() {
// new way of doing things
$("[data-gb]").each(function() {
var $this = $(this);
var gb_num = $this.attr("data-gb");
safe_log("lineUpMarginText: processing " + gb_num);
var target_id = "[data-id='realcomm3e_greenbullet_" + gb_num + "']";
var $target = $(target_id);
if ($target.length == 0) {
safe_log("lineUpMarginText: Can't find ID " + target_id);
return;
}
// get top position of 'mt-' span
var offset = $target.offset();
if (offset === null) {
safe_log("lineUpMarginText: " + target_id + " offset is null");
return;
}
// set target to same top position as mt- span
$this.css('top', offset.top + "px");
//$this.css('display', 'block');
});
// new way of doing things
$("[data-bb]").each(function() {
var $this = $(this);
var bb_num = $this.attr("data-bb");
safe_log("lineUpMarginText: processing " + bb_num);
var target_id = "[data-id='realcomm3e_bluebullet_" + bb_num + "']";
var $target = $(target_id);
if ($target.length == 0) {
safe_log("lineUpMarginText: Can't find ID " + target_id);
return;
}
// get top position of 'mt-' span
var offset = $target.offset();
if (offset === null) {
safe_log("lineUpMarginText: " + target_id + " offset is null");
return;
}
// set target to same top position as mt- span
$this.css('top', offset.top + "px");
//$this.css('display', 'block');
});
}
// ch 1
xBookUtils.links['channel'] = {px: 'bsi__E76D9730__1577__404B__B043__1AA8D48D3C50'};
xBookUtils.links['noise'] = {px: 'bsi__024BACBD__0B7B__495A__B04C__30309E5AB300'};
// ch 2
xBookUtils.links['social comparison theory'] = {px: 'bsi__86D20C0A__2402__48AB__A34F__49C254053382'};
xBookUtils.links['self-fulfilling prophecy'] = {px: 'bsi__227B7C39__EFF0__49E5__9B30__6E3A0A50C6D9'};
xBookUtils.links['self-monitoring'] = {px: 'bsi__70160B99__BF55__4F33__AACF__C08771BCD424'};
xBookUtils.links['self-disclosure'] = {px: 'bsi__39DBA5AD__FC5F__4A58__844D__4CECE0801F39'};
// ch 3
xBookUtils.links['denotative meaning'] = {px: 'bsi__D3536C6A__CEEC__4732__9698__37AC1AA15DB1'};
xBookUtils.links['connotative meaning'] = {px: 'bsi__33207639__CF2E__4CEE__AB09__433BB81B6E89'};
xBookUtils.links['evasion'] = {px: 'bsi__03EBF3C8__C233__4ED3__A5BE__F2839F0133B8'};
xBookUtils.links['equivocation'] = {px: 'bsi__12142FA0__F461__414C__983A__CB3E2E93D553'};
xBookUtils.links['euphemisms'] = {px: 'bsi__E938C8DE__D2C7__47AF__9EDD__E3C05B682307'};
// ch 4
xBookUtils.links['kinesics'] = {px: 'bsi__DA3E590A__F780__4F51__9105__5A7967B28EC1'};
xBookUtils.links['regulators'] = {px: 'bsi__A5AA79A4__D7A4__4D05__ABEC__EB9585973241'};
xBookUtils.links['adaptors'] = {px: 'bsi__7B624F34__24CF__4257__99D8__5DF85767C057'};
xBookUtils.links['contact cultures'] = {px: 'bsi__76E0299C__A9A3__4CE1__A585__43FD820212FE'};
xBookUtils.links['noncontact cultures'] = {px: 'bsi__15B28C0B__F452__4510__B9AD__FFB84B1C62B7'};
// ch 5
xBookUtils.links['high-context cultures'] = {px: 'bsi__7BE4165A__C0B8__4F95__A8A0__1ED05A806367'};
xBookUtils.links['low-context culture'] = {px: 'bsi__CB5FF6F1__E7FD__4A01__9FDC__485E0B69AB0B'};
xBookUtils.links['collectivist cultures'] = {px: 'bsi__9FEAF805__1273__4FC9__B1D3__239AAF68CE7E'};
xBookUtils.links['individualist cultures'] = {px: 'bsi__74F22B20__CD00__4B78__86DA__4B6F42500469'};
xBookUtils.links['high power distance cultures'] = {px: 'bsi__D8E71805__B7E9__42E1__904D__B3ED6161E5BB'};
xBookUtils.links['low power distance cultures'] = {px: 'bsi__18B3C6A9__1D91__4842__A734__CA34B1C2DC51'};
xBookUtils.links['time orientation'] = {px: 'bsi__5FEFDDA6__1602__4BF9__B257__30840D1F6EF4'};
// ch 6
xBookUtils.links['content-oriented listeners'] = {px: 'bsi__2F031D9C__0A84__435F__8B30__179F737B1678'};
xBookUtils.links['defensive listening'] = {px: 'bsi__B6E04B52__9EDD__4169__B78C__DFC9CAC9D9AE'};
xBookUtils.links['selective listening'] = {px: 'bsi__02691B7B__95A2__43B2__A56C__402FF1221DF9'};
// ch 7
xBookUtils.links['uncertainty reduction theory'] = {px: 'bsi__6014776E__13B3__4601__A552__EE39F0A54B4F'};
xBookUtils.links['dialectical tensions'] = {px: 'bsi__EB125813__AFA7__4304__AEF4__D9475130ADE5'};
xBookUtils.links['integrating'] = {px: 'bsi__01695FED__9B73__4A95__B3DD__3519F705E679'};
xBookUtils.links['bonding'] = {px: 'bsi__52DBDBE5__ED09__40D9__A491__C5A183993082'};
// ch8
xBookUtils.links['uncertain climates'] = {px: 'bsi__4F0E8972__1D4A__4E3C__AAD6__97DB3E5378F4'};
xBookUtils.links['defensive climates'] = {px: 'bsi__E9604911__021F__40F7__BE9E__E6EDCC8D70E7'};
xBookUtils.links['supportive climates'] = {px: 'bsi__2A54C289__E215__4259__B0C1__6A8C8DD6F4AB'};
xBookUtils.links['trolling'] = {px: 'bsi__10C6E07A__D346__4C9B__A447__C0C4C694E5A8'};
xBookUtils.links['compromising'] = {px: 'bsi__28B0BA8F__E451__4E8F__84E1__2D5B81FB8269'};
// ch 9
xBookUtils.links['forming'] = {px: 'bsi__71674720__5E35__445B__ABFC__69D80D9F3588'};
xBookUtils.links['storming'] = {px: 'bsi__15C7EE41__57D3__4496__9B9A__38B70B2684D0'};
xBookUtils.links['norming'] = {px: 'bsi__F7249DEC__61D9__4562__BC6F__CEB10C915A22'};
xBookUtils.links['performing'] = {px: 'bsi__025003D6__2377__414D__BA4D__62EB6DCADC5F'};
xBookUtils.links['adjourning'] = {px: 'bsi__9C8112B9__E8C8__47E5__8284__8CF83E4FA0D2'};
// ch 10
xBookUtils.links['legitimate power'] = {px: 'bsi__45D72B45__1D93__45DD__B651__650570E13A24'};
xBookUtils.links['coercive power'] = {px: 'bsi__9F69229F__D5E8__4A09__AB13__6B4D22934EC6'};
xBookUtils.links['reward power'] = {px: 'bsi__7128D513__0DCE__444A__9746__6BA70C9A9014'};
xBookUtils.links['expert power'] = {px: 'bsi__DAFDECBC__62FB__4339__8F41__781323596DDE'};
xBookUtils.links['referent power'] = {px: 'bsi__5D3B01B4__7DA9__4F08__815D__983935E627EC'};
// ch 11
xBookUtils.links['mentor'] = {px: 'bsi__FCE09C43__C8FF__457C__86E0__8931AC2896AD'};
xBookUtils.links['protégé'] = {px: 'bsi__3C1D22E1__B9EC__4583__8FD9__F472988A131B'};
xBookUtils.links['peer relationships'] = {px: 'bsi__1F21D85F__15B0__4439__94F6__5D532A57DD7A'};
// ch 12
xBookUtils.links['thesis statement'] = {px: 'bsi__EAC91804__A16A__4906__A83F__7075BC56EB88'};
xBookUtils.links['humorous anecdote'] = {px: 'bsi__4CE77075__F380__4007__BBC3__FD7A324BBB6A'};
xBookUtils.links['personal anecdote'] = {px: 'bsi__3F5B4E5A__7E06__49F3__BC1E__B2D2CC4A53C3'};
xBookUtils.links['anecdote with statistic'] = {px: 'bsi__151CA762__20A3__4709__A75F__3C2A524A222B'};
// ch 13
xBookUtils.links['problem-solution pattern'] = {px: 'bsi__6E131120__57C2__42C1__9666__9D2AE035EE32'};
xBookUtils.links['cause-effect pattern'] = {px: 'bsi__CFE7AC1C__7ECB__43FF__BD1E__7920A0E7C356'};
xBookUtils.links['motivated sequence pattern'] = {px: 'bsi__1CEA6196__1E01__4804__A120__5B6EF4366C07'};
xBookUtils.links['transitions'] = {px: 'bsi__2DACAE42__D16B__459F__B6E9__2629C69342D5'};
xBookUtils.links['internal previews'] = {px: 'bsi__E6AEA8CD__07A4__46B8__83B1__05191B6CE72A'};
xBookUtils.links['internal summaries'] = {px: 'bsi__605F8E99__F15B__46AC__AA3E__46416A41357E'};
// ch 14
xBookUtils.links['extemporaneous speaking'] = {px: 'bsi__539AFE64__7E28__416E__821E__65327D38767D'};
xBookUtils.links['monotone'] = {px: 'bsi__60864A6C__CA8B__4EB6__9AD3__6482CBF88E87'};
xBookUtils.links['prop'] = {px: 'bsi__3CD3A039__73CC__4509__8337__8D1C6BFA9188'};
// ch 15
xBookUtils.links['descriptive presentation'] = {px: 'bsi__B1441B1F__2134__4929__9349__DF051EDD6284'};
xBookUtils.links['demonstration speeches'] = {px: 'bsi__DA322CC2__6AAE__4E9C__BB3D__B7FCD08521B6'};
xBookUtils.links['definitional speeches'] = {px: 'bsi__D58EAB16__445E__4126__BC4B__205200E0AD39'};
xBookUtils.links['operational definition'] = {px: 'bsi__2CDB7B4A__7160__4C35__84C4__B0CB04D3ED52'};
xBookUtils.links['definition by example'] = {px: 'bsi__DEC1DA62__71C9__41BD__81C3__644CD9EFD913'};
// ch 16
xBookUtils.links['logos'] = {px: 'bsi__2D2ABC48__8506__472B__AEC4__1DCCEAD2C324'};
xBookUtils.links['pathos'] = {px: 'bsi__897F0C2C__AD21__4D79__ACAD__1A21A7C877FB'};
xBookUtils.links['bandwagon fallacy'] = {px: 'bsi__6F3CC697__B298__49DE__BDF7__AB7F0781FEFF'};
xBookUtils.links['ad hominem fallacy'] = {px: 'bsi__D7F49D69__C58C__4FBD__B9F2__AB977741C43B'};
xBookUtils.links['hasty generalization'] = {px: 'bsi__5D9D5649__B159__4508__9378__A8874B4F7784'};
xBookUtils.links['either-or fallacy'] = {px: 'bsi__997CC671__BC69__4A1B__A87B__9B0FC8C21112'};
// app B
xBookUtils.links['agenda setting'] = {px: 'bsi__0DE8E4FD__7674__4B04__A8FB__96A059EFDC27'};
xBookUtils.links['gatekeepers'] = {px: 'bsi__0DE8E4FD__7674__4B04__A8FB__96A059EFDC27'};
xBookUtils.links['citizen journalists'] = {px: 'bsi__AAAC6A6E__09B8__41F4__9FA5__FCD70FF94651'};
xBookUtils.links['user-generated content'] = {px: 'bsi__4EE45C0C__A02D__4E5E__B88E__9D57A4C4F149'};
// end
xBookUtils.links['yyy_end'] = {};