Here is a function that already exists in a theme:
function WShare( selector ) {
var $this = $( selector ), $parent = $this.parent();
var opt = {
url: window.location,
text: document.title,
};
if ( window.selectedText ) {
opt.text = window.selectedText;
}
if ( $parent.attr( 'data-sharing-url' ) !== undefined ) {
opt.url = $parent.attr( 'data-sharing-url' );
}
}
I want to switch the values of opt.text
and opt.url
within the if statements.
The reason for this change is that in the following JavaScript code, these two elements need to be swapped. What would be the most effective way to override this behavior?