Tags down


PageVisibility API - Change in browser console tab to act like active

By : BobGates
Date : October 17 2020, 01:08 AM
wish helps you Visibility api probably listens for events. When events trigger the page become visible/invisibile. You can create a synthetic event and thus trick the api. Depending on which events api uses you can try something like this:
code :
e = document.createEvent("HTMLEvents");
e.initEvent("focus", false, true);

Share : facebook icon twitter icon

Change browser add-on icon and data, according to active tab

By : Ivan Tolstukhin
Date : March 29 2020, 07:55 AM
I hope this helps . My understanding of your requirements, as you nicely described them, are comprised of 2 components that can be addressed in the background scope using the following Crossrider methods:
To detect tab changes use appAPI.tabs.onTabSelectionChanged. To monitor URL changes use appAPI.webRequest.onBeforeNavigate
code :
appAPI.ready(function($) {
    // Monitor tab selection changes
    appAPI.tabs.onTabSelectionChanged(function(tabInfo) {
        // tabInfo.Id = Tab Id
        // tabInfo.tabUrl = URL in tab

    appAPI.webRequest.onBeforeNavigate.addListener(function(details, opaqueData) {
        // details.pageUrl = URL of the tab requesting the page
        // opaqueData = data passed to the context of the callback function

    function updateButton(url) {
        // Your code to update the button based on URL

Active Record discrepancy between browser and console

By : SSirius
Date : March 29 2020, 07:55 AM
wish help you to fix your issue There must be some parent record which don't have any Images for that. That's why you are getting error. Below line will not give any error till parent.images.limit(1).order("RANDOM()") you have record or not. It will return either array of object or []. So better you check condition for blank images before this random.
code :
<% @parent.each.with_index do |parent, index| %>
  <h4><%= parent.name %></h4>
  <% if parent.images.present? %>
    <p><%= parent.images.limit(1).order("RANDOM()").first.caption %></p>
  <% else%>
    <p>No image there</p>
  <%end %>
<% end %>

PageVisibility HTML5 API on Safari

By : Zijad Salkic
Date : March 29 2020, 07:55 AM
I hope this helps . I checked caniuse for pagevisibility support and it states that Safari supports it. ,
code :
    var visibilityHidden, visibilityChange;
    if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support 
        visibilityHidden = "hidden";
        visibilityChange = "visibilitychange";
    } else if (typeof document.mozHidden !== "undefined") {
        visibilityHidden = "mozHidden";
        visibilityChange = "mozvisibilitychange";
    } else if (typeof document.msHidden !== "undefined") {
        visibilityHidden = "msHidden";
        visibilityChange = "msvisibilitychange";
    } else if (typeof document.webkitHidden !== "undefined") {
        visibilityHidden = "webkitHidden";
        visibilityChange = "webkitvisibilitychange";

    document.addEventListener("visibilitychange", function() {
      if (document[visibilityHidden]) {     
      } else {

I see the classes changing in the browser console but no visual change in the browser

By : sayani chakraborty
Date : March 29 2020, 07:55 AM
seems to work fine Just for practice sake, I am trying to change the background color of a div if you hover your mouse over it, and restore it back when you hover out. And if you click the div, I change its background color yet again to something different and make it editable. When you click outside, I restore things back to normal and make the div read-only again. , Remove ; from CSS and it will work and update CSS rule
code :
; <======== remove it
.canBeEdited.editable {
  background-color: #f2e793;
$(document).ready(function() {
  var theDiv = $("#theDiv");
  var isBeingEdited = false;

  theDiv.on("mouseover", null, true, makeAppearEditable);
  theDiv.on("mouseout", null, false, makeAppearEditable);

  theDiv.on("click dblclick", null, true, makeEditable);
  theDiv.on("blur", null, false, makeEditable);

  function makeAppearEditable(event) {

    console.log(event.target + ": " + event.type);
    var targetElement = $(event.target);

    if (isBeingEdited) {
      return false;

    if (event.data) {
    } else {

  function makeEditable(event) {
    console.log(event.target + ": " + event.type);
    var targetElement = $(event.target);
    isBeingEdited = event.data;
    targetElement.attr("contenteditable", event.data);
    if (event.data) {
    } else {
#theDiv {
  min-width: 400px;
  max-width: 50%;

.canBeEdited.editable {
  background-color: #f2e793;

.canBeEdited {
  background-color: yellow;
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<div id="theDiv">
  This is some text. When you hover over it, it will change its color to indicate that it can be edited. When you click it or double click it, it again change its color and will become editable. When you stop editing and click outside it, it will become
  non-editable and will change its color back to white.

How to change Shopify Title if the Browser tab is active or not

By : howdoiinstallthis
Date : March 29 2020, 07:55 AM
To fix this issue I'm trying to accomplish this in Shopify. , I found the solution myself:
code :
  var message = "Insert your message here";
  var original = document.title;

  window.onblur = function () { document.title = message; }
  window.onfocus = function () { document.title = original; }
Related Posts Related Posts :
  • How to set weight and height in Css with responsive when reduce screen size
  • Price formatting and user input value to change slider
  • Pass params to q.defer (d3.csv)
  • Combine a textfield and TinyMCE field to a third field with JavaScript. Constrain TinyMCE to Numbered List
  • Javascript regex to match alpha length followed by number length
  • Pass props from child to parent react navigation
  • How to share redux store in multiple components
  • Javascript Regex Expression Not Returning Expected Value
  • with draft.js is it possible to create a custom block span with classname
  • How to convert Javascript object to a url string?
  • Adobe Javascript in Action Wizard vs a form button
  • Filtering Tooltip in Kendo
  • How to update a grouped bar-chart in d3js
  • Javascript ES6 custom sort method not working all the times
  • Use a Vue JS component method in another vue comonent
  • Disable copy text from tinymce textarea
  • Need Dropdown to fill out db info on my page using AJAX
  • Join two arrays of objects on property
  • Angular checkboxes for objects within array
  • jQuery append to HTML table
  • Same DOM element is inserting after the input elements while validating form
  • Mocha flow control after assertion fails
  • AFrame content not rendering on Chrome with hyperHTML
  • Able to create multiple users with same email despite email set as unique in Mongoose
  • I am having trouble getting my text input to append <li> to a blank <ul> in my html
  • Ajax not parsing data correctly?
  • Rewrite of an vanilla JS Pong with the help of PixiJS
  • Manipulating object arrays for unique data
  • drag event is being fired on click
  • If not working after lower-casing and trimming
  • Hiding element on body click
  • What am I supposed to write in my if condition in order to check if there is a record in my MySQL query?
  • Why does Typescript think async/await returns a value wrapped in a promise?
  • How can I make the Menu closed, after clicking a Link (on mobile screen)?
  • Hover bootstrap datepicker
  • Materialize - Using Carousel functionalities
  • How to add event to every image using ES5
  • Getting 200 response, but also CORS error?
  • Wrap text within #id>span in href
  • Return all docs when all docs are deleted in a collection in Firestore
  • ClojureScript deep equal for JavaScript objects
  • Load multiple json files and display it to the html using ajax and jquery
  • Force spaces to convert to %20 from HTML input field using js or jQuery
  • React-Bootstrap Modal rendering twice
  • How to make a side panel in a component with Quasar Vue Framework 14.3
  • jquery checkall button and uncheckall button to select other checkbox
  • JavaScript loop doesn't work
  • jQuery if list item contains ''-" .remove()?
  • express strips newline when reading buffer and returning in response
  • Sort table both numerically and alphabetically using Javascript
  • js TreeWalker and/or document.createRange() not picking up single element
  • Read a field from every array object
  • MongoDB update array of documents with new array of documents
  • Disable Checkbox on Certain Date? JavaScript
  • Simple Angular JS Module Not Working, But Master Angular Script Working
  • Cordova Unable to load platformapi
  • Make multiple screenshots with nightmare-screenshot-selector
  • Combining values in nested objects with common properties
  • Create object from JSON using headers from JSON
  • scroll event not firing on div inside scroll-able div
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com