Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamrealfarhanbd/186ce707733e590f9bab922fd6db1ad5 to your computer and use it in GitHub Desktop.
Save iamrealfarhanbd/186ce707733e590f9bab922fd6db1ad5 to your computer and use it in GitHub Desktop.
This jQuery solution for Ninja Tables removes the portion "https://www.google.com/url?q=" from the href attribute of anchor tags within elements with the class "ninja_clmn_nm_product". It ensures that when using Ninja Tables with Google Sheets integration, the redirection notice from Google Sheets URLs is removed, providing a smoother user exper…
$(document).ready(function() {
// Function to remove the unwanted portion from href attribute
function removeUrlPortion() {
let $table = $('.ninja_clmn_nm_product');// Replace YourColumnKey With your column key like = .ninja_clmn_nm_YourColumnKey
$table.find('a').each(function() {
let href = $(this).attr('href');
// Check if href contains the unwanted portion
if (href.includes('https://www.google.com/url?q=')) {
// Remove the unwanted portion from href
let newHref = href.replace('https://www.google.com/url?q=', '');
$(this).attr('href', newHref);
}
});
}
removeUrlPortion();
// Call the function after filtering and paging
$table.on('after.ft.filtering', function() {
removeUrlPortion();
});
$table.on('after.ft.paging', function() {
removeUrlPortion();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment