BudwiseЯ
BudwiseЯ

Reputation: 1826

How to modify advlink.js?

What I thought should have been easy has now taken great amount of my time.

I'm simply trying to edit some text in the /plugins/advlink/js/advlink.js file.

Consider this function:

function getTargetListHTML(elm_id, target_form_element) {
    var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
    var html = '';
    html += '<select id="' + elm_id + '" name="' + elm_id + '" onchange="this.form.' + target_form_element + '.value=';
    html += 'this.options[this.selectedIndex].value;">';
    html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
    html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';
    html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>';
    html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>';

    for (var i=0; i<targets.length; i++) {
        var key, value;

        if (targets[i] == "")
        continue;

        key = targets[i].split('=')[0];
        value = targets[i].split('=')[1];

       html += '<option value="' + key + '">' + value + ' (' + key + ')</option>';
    }

    html += '</select>';

    return html;
}

If I make changes to for example advlink_dlg.target_blank in the appropriate language file, the changes seems to show up ok.

But if I try to change the ' (_blank)' on the same line to whatever, eg. ' (__blank)', nothing happens. Why is that?

Upvotes: 1

Views: 524

Answers (1)

Thariama
Thariama

Reputation: 50832

What you did should work!

I changed the line (in /plugins/advlink/js/advlink.js) to

html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (XXXXXXXXXXXX_blank)</option>';

and see what i got after selecting some text + pushing the link-button:

enter image description here

Upvotes: 1

Related Questions