Skip to content

Instantly share code, notes, and snippets.

@noromanba
Created April 25, 2017 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noromanba/e5020682a9dc6ade06a019615425c7cd to your computer and use it in GitHub Desktop.
Save noromanba/e5020682a9dc6ade06a019615425c7cd to your computer and use it in GitHub Desktop.
scroll into changed flags on Chrome/mium for Devtools Console
// @name next +flag
// @namespace http://noromanba.flavors.me
// @description scroll into changed flags on Chrome/mium for Devtools Console
// @include chrome://flags/*
// @version 2017.4.25.1
// @homepage https://gist.github.com/noromanba/e5020682a9dc6ade06a019615425c7cd
// @license MIT License https://nrm.mit-license.org/2017
// @author noromanba http://noromanba.flavors.me
// view all changed flags below, see "Command Line" section
// chrome://version/
(() => {
'use strict';
Array.from(document.body.querySelectorAll([
'.experiment-switched'
])).some(switched => {
const feature = new URL(switched.querySelector([
'a[href].permalink'
]).href).hash;
// http://let.hatelabo.jp/noromanba/let/hLHWrt-tvNtK
// current scrolling values
// window.scrollY
// window.pageYOffset
// document.documentElement.scrollTop
// document.body.scrollTop
const absPos = Math.trunc(switched.getBoundingClientRect().top
+ document.body.scrollTop);
if (location.hash === feature ||
absPos <= document.body.scrollTop) {
return;
}
location.hash = feature;
return true;
// TBD back to #top when scroll to last/bottom
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment