Showing posts with label google chrome. Show all posts
Showing posts with label google chrome. Show all posts

Tuesday, November 3, 2026

Creating Sub menu in Chrome extension - snippet for selecting 5th value in drop down list

 background.js

// 1. Create the main parent menu item

chrome.runtime.onInstalled.addListener(() => {

  chrome.contextMenus.create({

    id: "parentMenu",

    title: "My Extension Options",

    contexts: ["all"] // Shows up on text selection, links, pages, etc.

  });


  // 2. Create sub-menu items linked to the parent ID

  chrome.contextMenus.create({

    id: "subMenu1",

    parentId: "parentMenu",

    title: "Select 5th Option",

    contexts: ["all"]

  });


  chrome.contextMenus.create({

    id: "subMenu2",

    parentId: "parentMenu",

    title: "Clear Selection",

    contexts: ["all"]

  });

});


// 3. Handle clicks on the sub-menu items

chrome.contextMenus.onClicked.addListener(async (info, tab) => {

  if (info.menuItemId === "subMenu1") {

    // Inject a script into the active page to select the 5th value

const activeTabId = info.tabId || (tab && tab.id);

    debugger;

    if (!activeTabId) {

      console.error("No active tab ID found.");

      return;

    }

    chrome.scripting.executeScript({

      target: { tabId: tab.id },

      func: selectFifthValue

    });

  } else if (info.menuItemId === "subMenu2") {

    console.log("Sub-menu 2 clicked!");

  }

});


// This function runs directly inside the web page's context

function selectFifthValue() {

  const selectElement = document.querySelector('select[formcontrolname="sectionName"]');

  if (selectElement && selectElement.options.length >= 5) {

    selectElement.selectedIndex = 5;

    selectElement.dispatchEvent(new Event('change', { bubbles: true }));

  }

  else {

  console.error("Dropdown not found. Check if your formControlName is correct.");

}

}

Thursday, October 29, 2026

How to call a function two time in chrome extension - also click on search and view in function snippets - Create Right Click in chrome with chrome extension

 menifest.json

{

  "manifest_version": 3,

  "name": "Run Snippet from Right Click",

  "version": "1.0",

  "permissions": [

    "contextMenus",

    "activeTab",

    "scripting","storage"

  ],

  "background": {

    "service_worker": "background.js"

  }

}

Tuesday, October 27, 2026

How to create extension and load extension in chrome

 

Step 1: Create a Folder

Create a new folder on your computer and name it something like SearchAndViewExtension.

Step 2: Create the Configuration File (manifest.json)

Inside that folder, create a file named manifest.json and paste the following code. This tells Chrome to register a background service worker and requests permission to run scripts:

json

{

  "manifest_version": 3,

  "name": "Run Snippet from Right Click",

  "version": "1.0",

  "permissions": [

    "contextMenus",

    "activeTab",

    "scripting"

  ],

  "background": {

    "service_worker": "background.js"

  }

}

Use code with caution.

Step 3: Create the Background Script (background.js)

Inside the same folder, create a file named background.js. This script creates the actual right-click menu item and injects your click automation automation script into the page when clicked:

javascript

// 1. Create the right-click menu item when the extension installs

chrome.runtime.onInstalled.addListener(() => {

  chrome.contextMenus.create({

    id: "runSearchAndViewAutomation",

    title: "Run Search & View Automation",

    contexts: ["all"] // Makes it appear on any right-click

  });

});

 

// 2. Listen for clicks on your custom menu item

chrome.contextMenus.onClicked.addListener((info, tab) => {

  if (info.menuItemId === "runSearchAndViewAutomation") {

    // Inject and execute your snippet script directly onto the active tab

    chrome.scripting.executeScript({

      target: { tabId: tab.id },

      func: automatedSearchAndView

    });

  }

});

 

// 3. Your core snippet script wrapped in a function

async function automatedSearchAndView() {

  const searchButton = document.querySelector('#search-btn-id'); // <-- Change selector as needed

 

  if (!searchButton) {

    console.error("Automation Stopped: Search button not found.");

    return;

  }

 

  searchButton.click();

  console.log("Search button clicked. Monitoring DOM for the anchor tag...");

 

  const waitForElement = (selector, timeout = 5000) => {

    return new Promise((resolve, reject) => {

      const startTime = Date.now();

      const interval = setInterval(() => {

        const element = document.querySelector(selector);

        if (element) {

          clearInterval(interval);

          resolve(element);

        } else if (Date.now() - startTime > timeout) {

          clearInterval(interval);

          reject(new Error(`Automation Timeout: Link "${selector}" not found.`));

        }

      }, 100);

    });

  };

 

  try {

    const viewAnchor = await waitForElement('a.your-class-name'); // <-- Change selector as needed

   

    if (viewAnchor.href && viewAnchor.href !== '#' && !viewAnchor.href.startsWith('javascript:')) {

      window.location.href = viewAnchor.href;

    } else {

      viewAnchor.click();

    }

  } catch (error) {

    console.error(error.message);

  }

}

Use code with caution.

Step 4: Load it into Google Chrome

1.      Open Chrome and navigate to chrome://extensions/

2.      Turn ON the toggle switch for Developer mode in the top-right corner.

3.      Click the Load unpacked button in the top-left corner.

4.      Select the SearchAndViewExtension folder you created.

 

Friday, May 1, 2026

How to enable right click on website

Add this line to console


document.addEventListener('contextmenu', event => event.stopPropagation(), true); 

Monday, February 16, 2026

Snippets in chrome for CSS style - Snippet in chrome for CSS style


(function() {

  let style = `<style>

   .p-datatable .p-datatable-tbody>tr>td{

color: black;

}

  </style>`;

  document.head.insertAdjacentHTML("beforeend", style);

})();

Thursday, February 5, 2026

Vibration of font in chrome - Shaking of font in chrome - transform in css - color change in second - Keyframes in CSS - blinking in CSS - blinking in css - color blinking

HTML

<img src="https://ik.imagekit.io/ikmedia/css-image-effects/new-york_lbAbZZKZG.jpg" alt="new york" />

</br>


img {

  width: 300px;

}

img:hover {

  /* Start the shake animation and make the animation last for 0.5 seconds */

  animation: vibrate 0.1s;


  /* When the animation is finished, start again */

  animation-iteration-count: infinite;

}

@keyframes vibrate {

  0% { transform: rotate(0deg); }

  10% { transform: rotate(-1deg); }

  20% { transform: rotate(1deg); }

  30% { transform: rotate(0deg); }

  40% { transform: rotate(1deg); }

  50% { transform: rotate(-1deg); }

  60% { transform: rotate(0deg); }

  70% { transform: rotate(-1deg); }

  80% { transform: rotate(1deg); }

  90% { transform: rotate(0deg); }

  100% { transform: rotate(-1deg); }

}



OR


<p class="vibrating-text"> dfdf dfd ddfd df</p>

CSS

@keyframes vibratetext {

  0% { transform: translate(0, 0); }

  20% { transform: translate(-1px, 1px); }

  40% { transform: translate(-1px, -1px); }

  60% { transform: translate(1px, 1px); }

  80% { transform: translate(1px, -1px); }

  100% { transform: translate(0, 0); }

}

Thursday, January 29, 2026

How to convert any website to black and white or colorless in Chrome - Increase or decrease colors in website of chrome - Saturation in google chrome - Color in chrome - strength radius and sharpness in website of chrome - Greyscale in Chrome

 > Go to Inspect element (F12)

> In body tag

> Go to styles

> In element style paste -webkit-filter: grayscale(100%);

> In element style paste filter: grayscale(100%);


and if you use 10%, 20% color will be increase or decrease in Chrome website.

or you can use below extension for chrome to decrease or increase saturation or colors

https://chromewebstore.google.com/detail/web-color-filter/njnaggoebacjnbklkcccmbnpfmeagcmp


https://chromewebstore.google.com/detail/video-image-control-new-g/mdoelcifdkcimkdbfkjjnedabmjlkokc


https://chromewebstore.google.com/detail/chrome-font-super-enhance/ombebcdhklmmkcddekoplmobafpkolmd

A+ FONT SIZE CHANGER (FOR COLOR CHANGE)

or you can download video image control source code from below link and add extension to chrome.

https://chrome-stats.com/d/mdoelcifdkcimkdbfkjjnedabmjlkokc

How to change cursor in Chrome - Chrome Extension

 Use Custom cursor extension in Google Chrome


Extension name :- https://custom-cursor.com/


https://chromewebstore.google.com/detail/custom-cursor-for-chrome/ogdlpmhglpejoiomcodnpjnfgcpmgale?hl=en

Thursday, January 8, 2026

How to enable text cursor in Chrome - Highlight on object in Chrome

>  In settings of Google Chrome

> Click on Accessibility 

> Click on navigate pages with a text cursor


---------

Click on HIGHLIGHT ON FOCUS OBJECT


Friday, December 26, 2025

How to create notepad in Chrome

Enter below text in Chrome URL


 data:text/html, <title>Notepad</title><body contenteditable style="font-size:18px;line-height:1.6;font-family:sans-serif;">

Tuesday, November 25, 2025

How to use chrome as file explorer - How to open folder in Chrome

Type this below code in URL

 file:///C:/

How to add styles to live website in chrome - How to change styles to live website in chrome - How to change background color in live website in chrome

 > Open developer tools in chrome

> Go to sources tab and select overrides tab

> Click on "select folder for overrides" and Select the folder where you want to change the overrides

> Right click on element of website and change color of background or style 

> Click on sources tab and Page tab and save the css file in folder where you select the folder above.


If you want to delete, goto sources tab and goto overrides tab and delete overrides. And the website will be able to run as it was.

Note:-

After the above steps, For Enable styles that you edit, right click and inspect  > Go to Sources> Overrides> Check Enable Local Overrides 

 For disable styles that you edit, right click and inspect  > Go to Sources> Overrides> UnCheck Enable Local Overrides or refresh page will disable style overrides



or you can use stylebot extension in chrome.

Thursday, November 13, 2025

Thursday, November 6, 2025

How to create shortcut of URL in chrome

> First Open chrome

 > Click on 3 dots and click on cast, save and share

>Click on create shortcut and a shortcut will be created.

Tuesday, October 28, 2025

How to block or unblock css in website in chrome - How to change agent of chrome

 > Go to chrome developer tools

> Go to Network Tab

> Click on CSS, JS, ALL

> Press CTRL + F5 Key and you will see files. You can block that files.

> And you can change slow 4g or fast 4g or you can change agent in Chrome.

How to record website in chrome

 >Open developer tools

> Click on Recorder

> Click on Create recording

> Click on Start recording.

> Click on website and when you click on buttons and anywhere it will save.

>You can import, export and delete the recordings.

>It will save as JSON file.

>Click on play recording to play.

Friday, September 5, 2025

How to do eye protection in window 11 - How to do eye protection in window 10 - Eye protection in chrome

 > Search for night light (Turn it on)option in search under display settings

> Also you can search for color filter settings in search option

> Also search for "adjust clear text" setting in search option under window button click

>Also you can search for brightness and change the brightness level

> Also you can increase Zoom in Chrome browser (Min 110% is good).

> Also you can go to font and (chrome://settings/fonts) and min size to 15 and normal font size to 16.

> chrome://settings/system, enable or disable hardware acceleration

Also you can use apps like eye saver, CareUEyes


Also you can use Magnifier.

Also you can use scale from 100% to 110% from display settings.(Min 110% is good )

Also you can use resolution change. and color in Intel graphics command centre.

Also you can go to text size in scale in system settings and change it to 100% to 110%.(Min 110% is good )

Also you can use incognito window (Ctrl + Shift + N) for eye protection because in normal window and incognito window CSS of font is different


Also Change CSS color: #495057; to color: black; in Class.

====================================

Snippets in chrome - Snippet in chrome:-

If color is color: #495057; in css

Also you can create snippets in chrome developer tools 

> Go to Source and create new snippets

and paste below code

(function() {

  let style = `<style>

   .p-datatable .p-datatable-tbody>tr>td{

color: black;

}

  </style>`;

  document.head.insertAdjacentHTML("beforeend", style);

})();

=============================================

Also you can use visual vibration images, examples :- https://img.freepik.com/free-vector/realistic-optical-illusion-background_52683-54383.jpg?semt=ais_hybrid&w=740&q=80

https://kapooryash.blogspot.com/2026/02/vibration-of-font-in-chrome-shaking-of.html

https://i.pinimg.com/736x/82/b2/5f/82b25fed9db53b364d55bc80f9d76efc.jpg

ref:- https://allthings.how/how-to-change-brightness-on-windows-11/