Skip to content

Instantly share code, notes, and snippets.

View dhilipkmr's full-sized avatar
🎯
Focusing

Dhilip kumar Velusamy dhilipkmr

🎯
Focusing
View GitHub Profile
@dhilipkmr
dhilipkmr / ripple.css
Created January 21, 2019 18:35
Css for Ripple
/* Ripple */
[ripple] {
position: relative;
overflow: hidden;
}
[ripple] .ripple--container {
position: absolute;
top: 0;
right: 0;
bottom: 0;
@dhilipkmr
dhilipkmr / CssBoilerPlateRipple.css
Last active January 26, 2019 19:50
React Boiler Plate
.btn {
margin: 50px auto;
border-radius: 25px;
background-color: #5300e8;
box-shadow: 0 2px 4px 0 #888888;
display: inline-block;
padding: 15px 50px;
color: #ffffff;
}
.center {
<div class="ripple">
Click Me
<div class="rippleContainer">
<span><span>
</div>
</div>
@dhilipkmr
dhilipkmr / JsRippleFinal.js
Last active January 22, 2019 17:51
FinalRipple
const {React} = window;
const {ReactDOM} = window;
class Ripple extends React.Component {
constructor(props) {
super(props);
}
callCleanUp(cleanup, delay) {
var bounce;
render() {
const {children= null, classes = "", onClickHandler = null} = this.props;
return (
<div ref="targetElement" className={'ripple ' + classes} onClick={onClickHandler}>
{children}
<div className="rippleContainer" onMouseDown={this.showRipple} onMouseUp={this.callCleanUp(this.cleanUp, 2000)}>
{this.renderRippleSpan()}
</div>
</div>
);
@dhilipkmr
dhilipkmr / showRippleFnc.js
Last active January 26, 2019 20:07
Show Ripple
showRipple = (e) => {
const rippleContainer = e.currentTarget;
const size = rippleContainer.offsetWidth;
const pos = rippleContainer.getBoundingClientRect();
const x = e.pageX - pos.x - (size / 2);
const y = e.pageY - pos.y - (size / 2);
const spanStyles = { top: y + 'px', left: x + 'px', height: size + 'px', width: size + 'px' };
const count = this.state.count + 1;
this.setState({
spanStyles: {...this.state.spanStyles, [count] : spanStyles},
@dhilipkmr
dhilipkmr / spanRemovalRipple.js
Last active January 26, 2019 19:49
removing Span
cleanUp = () => {
const initialState = this.initializeState();
this.setState({ ...initialState });
}
callCleanUp = (cleanup, delay) => {
return function() {
clearTimeout(this.bounce);
this.bounce = setTimeout(() => {
cleanup();
{
"manifest_version": 2,
"name": "IMDB Ratings",
"version": "0.1",
"content_scripts": [
{
"matches": [ "<all_urls>" ],
"js": ["content.js"]
}
],
/* clicking the addon icon */
chrome.browserAction.onClicked.addListener(buttonClicked);
function buttonClicked(tab) {
var msg = {
type: 'clickResponse',
buttonClicked: true
}
chrome.tabs.sendMessage(tab.id, msg);
};
@dhilipkmr
dhilipkmr / content.js
Created February 6, 2019 10:56
call listen to mouseover
chrome.runtime.onMessage.addListener(hasGotMessage);
function hasGotMessage(response, sender, sendResponse) {
switch (response.type) {
case 'clickResponse':
window.sessionStorage.setItem('_imdbRaterEnabled', "1");
listenToMouseover();
break;
}
}