ModCaption & ModHeader scripts

Hi Jon. I’m setting up a series to show our fleets captains the effect of using the EHS progressive handicapping template, kindly created by Huw.
I’m pretty much there but am having difficultly getting the ModCaption script to change the rating system in the summary table from NHC4 to EHS. Or, more acurately,
when I use the attached script, ModCaption-EHS.js, it changes the Handicap fleet summary table caption as required but also appends the Scatch fleet
summary caption immediately afterwards. It also repeats this behaviour for the Scratch fleet summary table caption,
i.e. both summary captions for both summary tables. See attached file 'All Saturday Points - Hcap - ModCaption.htm.

I also cannot get the ModHeader script, ModHeader-Initial.js, to change the Handicap fleet summary table column header text from ‘This’ to ‘Initial’,
and the script ModHeader-Final.js, to change the Handicap fleet summary table column header text from ‘Next’ to ‘C/Fwd’.

When using all 3 scripts, 4 including the RatingShow script, some very odd results are produced.

Any help in getting these scripts to make the changes I’d like to use would be most appreciated.

All files attached.

All Saturday Points - Hcap.blw (77.5 KB)

All Saturday Points - Hcap - ModCaption.htm (86.7 KB)

RatingsShow-RCYC.js (636 Bytes)

ModHeader-Initial.js (435 Bytes)

ModHeader-Final.js (433 Bytes)

ModCaption-EHS.js (456 Bytes)

Many thanks.

Julian.

Hi Julian

Unfortunately, the js files are not readable

Perhaps you could email them to me directly at jon@sailwave.com

Jon

Jon,

JS files just sent. The only change I’ve made to the std RatingsShow.js file is to change the colour of the displayed rating.

Regards,

Julian.

Hi Julian

Try replacing the ModHeader effects with this one

//
// name=ModHeader-RCYC
// dependencies=jQuery
// description=Modify summary tables Headers for RCYC.

$(document).ready(function () {

$(“.summarytable th”).each(function() {
$(this).text($(this).text().replace(‘Next Race’, ‘C-Fwd Race’));
});

$(“.summarytable th”).each(function() {
$(this).text($(this).text().replace(‘This Race’, ‘Initial Race’));
});

});

I named it ModHeader-RCYC.js

This does both of what you want in one file.
Let me know if you have any questions and if it all works now?

Jon

Good evening Jon,

Alas no, the above script made no difference.

However, after a little web digging, and a lot of trial and much error, I did come up with the following;

//
// name=ModHeader-RCYC
// dependencies=jQuery
// description=Modify summary tables Headers for RCYC.

$(document).ready(function () {

$(“.summarytable tr”).eq(0).find(‘th’).eq(6).html(‘Initial Race Rating’);

$(“.summarytable tr”).eq(0).find(‘th’).eq(7).html(‘C/Fwd Race Rating’);

});

This seems to do the job nicely. See attached file ‘All Saturday Points - Hcap - ModHeader.htm’

Note; I have only published the Handicap fleet which makes the ModCaption-EHS script to work.

If I also publish the Scratch fleet then the summary table caption contains the text for both the Handicap and Scratch fleets, repeated for both summary tables. See attached file ‘All Saturday Points - Hcap - ModCaption & ModHeader.htm’.

This still has me stumped.

//
// name=ModCaption-EHS
// dependencies=jQuery
// description=Modify summary tables captions.
// author=Jon Eskdale
// date=2016-04-14
// version=1.0
// url=http://sailwave.com
// email=jon@sailwave.com
// twitter=@eskdale
//

var sOrig = ‘NHC4’;
var sReplace = ‘EHS’;
var sSelector = ‘.caption.summarycaption’;

$(document).ready(function () {
$(sSelector).text($(sSelector).text().replace(sOrig, sReplace));
});

Many thanks.

Regards, Jools.

All Saturday Points - Hcap - ModHeader.htm (46.6 KB)

All Saturday Points - Hcap - ModCaption & ModHeader.htm (87.0 KB)

Hi Jools,

I don’t know why that didn’t work for you - I tested it, and it works fine for me.
As long as you are happy that is fine but yours requires the column to be specific so if you add or remove or rearrange the columns, then you will need to edit your effect.

If you only want to modify the caption of the first summary table

try this

//
// name=ModCaptionFirst
// dependencies=jQuery
// description=Modify summary tables captions.
// author=Jon Eskdale
// date=2026-0-15
// version=1.0
// url=http://sailwave.com
// email=jon@sailwave.com
// twitter=@eskdale
//

var sOrig = ‘NHC4’;
var sReplace = ‘EHS’;
var sSelector = ‘.caption.summarycaption’;

$(document).ready(function () {
// Only operate on the first matching caption (i.e. first summary table)
var $firstCaption = $(sSelector).first();
$firstCaption.text($firstCaption.text().replace(sOrig, sReplace));
});

Regards

Jon

Hello Jon,

I’m afraid that did not work. It actually negated all the other scripts, i.e. the progressive ratings were no longer shown, and the table header text changed by the ModHeader script was no longer changed.

I’m using Win 10 and Firefox if that maybe the cause of these Mod scripts not working for me.

Regards,

Jools.