Skip to content

Instantly share code, notes, and snippets.

View iamrealfarhanbd's full-sized avatar
💻
always do code

Farhan Ahmed iamrealfarhanbd

💻
always do code
View GitHub Profile
@iamrealfarhanbd
iamrealfarhanbd / Fluent Forms jQuery Function to Remove Dash from Progress Bar Step Indicators.js
Created May 3, 2024 05:13
Fluent Forms: jQuery Function to Remove Dash from Progress Bar Step Indicators
// Hide the dash initially when the document is ready
jQuery(document).ready(function() {
function removeDash() {
jQuery('.ff-el-progress-status').each(function() {
var text = jQuery(this).text().trim(); // Get the text content of the element
var newText = text.replace('-', ''); // Remove the dash
jQuery(this).text(newText); // Set the modified text back to the element
});
}
removeDash();
@iamrealfarhanbd
iamrealfarhanbd / Ninja Tables: Remove Google Sheet Redirection from Anchor Tags.js
Created April 2, 2024 06:04
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
@iamrealfarhanbd
iamrealfarhanbd / Prevent Text Selection for Ninja Tables.js
Created March 7, 2024 06:18
This Gist provides CSS and JavaScript code snippets to prevent users from copying content from a webpage by disabling text selection and right-click context menu. These measures can serve as a deterrent against unauthorized copying of website content. You can choose to implement either the CSS or JavaScript solution based on your preference.
// Disable text selection with css
#footable_parent_NT_ID {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
pointer-events: none;
}
/*********************
add_filter('ninja_tables_before_update_settings', function ($columns, $tableId) {
function modifyData($columns) {
if (isset($_REQUEST['columns'])) {
return $_REQUEST['columns'];
} else {
return $columns;
}
}
@iamrealfarhanbd
iamrealfarhanbd / Conditional_Display_of_Download_Button_in_FluentForm.js
Last active January 5, 2024 12:06
jQuery code to conditionally display a download button (.nt_download_me) in FluentForm when a specific success class (.fluentform_18_success) is present. Ensures the button is shown only after the submit button is clicked and the success class is rendered
jQuery(document).ready(function ($) {
// Function to check if the success message is present
function checkSuccessMessage() {
jQuery('.kt-modal-content').each(function() {
if ($(this).find('.ff-message-success').length > 0) {
// Success message is present
$(this).find('.nt_download_me').show();
console.log('.nt_download button shown');
} else {
// Success message is not present
@iamrealfarhanbd
iamrealfarhanbd / ninja_table_search_time_delay_filter.php
Created December 15, 2023 06:42
Code snippet to modify the delay time for Ninja Tables filter functionality.
/**
* Adjust the delay time for Ninja Tables filter functionality.
*
* @param int $delayTime The default delay time in milliseconds.
* @param int $tableId The ID of the Ninja Table.
* @return int The modified delay time.
*/
add_filter('ninja_table_search_time_delay', function ($delayTime, $tableId) {
if ($tableId == 1) {
@iamrealfarhanbd
iamrealfarhanbd / Excel Formula: Extract and Render Multiple Images from Comma-Separated URLs.xlsx
Created October 27, 2023 05:09
This Excel formula efficiently handles scenarios where a cell contains either a single image URL or multiple URLs separated by commas (,). It transforms these URLs into <img> tags for easy rendering. The formula intelligently detects the presence of commas, distinguishing between single and multiple URLs. For single URLs, it directly generates a…
//If you are using Ninja Tables instead of Google Sheets, replace A1 with your reference shortcode.
//Ex "{{Your_Reference_Shortcode}}"
//Ninja tables
=IF(ISNUMBER(SEARCH(",", "{{Your_Reference_Shortcode}}")),
"<img src='" & SUBSTITUTE("{{Your_Reference_Shortcode}}", ",", "'><img src='") & "'>",
"<img src='" & "{{Your_Reference_Shortcode}}" & "'>")
//Google Sheets
=IF(ISNUMBER(SEARCH(",", A1)),
@iamrealfarhanbd
iamrealfarhanbd / Ninja-tables-Simple-tooltip.css
Last active October 17, 2023 06:09
a simple tooltip that has been made by Farhan for Ninja Tables
/*
* a simple tooltip that has been made by Farhan
*/
/********************************************************
HTML
********************************************************/
<span class="ninja-tooltip" data-tooltip="I'm in top">Ninja Tables</span>
@iamrealfarhanbd
iamrealfarhanbd / Formatting_Number_in_Ninja_Tables.js
Last active October 6, 2023 05:09
jQuery Code for Formatting Numbers in a Table Column
// you can replace "_amount" with you column key column_key
$('tbody .ninja_clmn_nm_amount').each(function() {
// Get the cell value and parse it as an integer
var cellValue = parseInt($(this).text().trim());
// Check if the value is 1000 or more
if (cellValue >= 1000) {
// If it's 1000 or more, format the value with commas
$(this).text(cellValue.toLocaleString());
@iamrealfarhanbd
iamrealfarhanbd / Ninja_Tables_first_column_freeze.css
Created September 25, 2023 10:43
Custom CSS code to make the left first columns of a Ninja Table sticky when scrolling to the right.
#footable_parent_NT_ID tbody tr td:nth-child(1), #footable_parent_NT_ID thead th:nth-child(1){
position: sticky;
position: -webkit-sticky;
left: 0;
z-index: 1;
background: #fafafb;
font-weight:bold;
}