Skip to content

Commit

Permalink
Merge pull request #443 from aeternity/release/0.3.0
Browse files Browse the repository at this point in the history
Release 0.3.0
  • Loading branch information
mradkov authored Aug 6, 2020
2 parents 2f652fc + 9cbf3e9 commit 8f417f4
Show file tree
Hide file tree
Showing 59 changed files with 3,350 additions and 485 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.superhero.cordova" version="0.2.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.superhero.cordova" version="0.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Superhero</name>
<description>Superhero wallet</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superhero-wallet",
"version": "0.2.4",
"version": "0.3.0",
"description": "Superhero wallet",
"author": "Superhero",
"license": "MIT",
Expand All @@ -12,7 +12,7 @@
"prettier": "prettier \"src/**/*.{js,vue}\" \"tests/**/*.{js,vue}\"",
"prettier:write": "npm run prettier -- --write",
"build": "cross-env NODE_ENV=production webpack --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --hide-modules -d",
"build-zip": "node scripts/build-zip.js",
"watch": "npm run build -- --watch",
"watch:dev": "cross-env HMR=true npm run build:dev -- --watch",
Expand All @@ -25,8 +25,8 @@
"build:Mainnet": "cross-env NETWORK=Mainnet npm run build",
"watch:dev:Testnet": "cross-env NETWORK=Testnet npm run watch:dev",
"watch:dev:Mainnet": "cross-env NETWORK=Mainnet npm run watch:dev",
"watch:dev:tests": "cross-env NETWORK=Testnet cross-env RUNNING_IN_TESTS=true npm run watch:dev",
"build:tests": "cross-env NETWORK=Testnet cross-env RUNNING_IN_TESTS=true npm run build:dev"
"watch:dev:tests": "cross-env NETWORK=Testnet RUNNING_IN_TESTS=true npm run watch:dev",
"build:tests": "cross-env NETWORK=Testnet RUNNING_IN_TESTS=true npm run build:dev"
},
"dependencies": {
"@aeternity/aepp-components": "git+https://github.com/aeternity/aepp-components.git#develop",
Expand Down
64 changes: 29 additions & 35 deletions src/content-scripts/twitter.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
/* eslint-disable no-continue */
import iconHover from '../icons/twitter-icon-tip-hover.svg';
import icon from '../icons/twitter-icon-tip.svg';

global.browser = require('webextension-polyfill');

let timeout = null;
const isInContent = !window.location.href.includes(browser.extension.getURL('./'));
const buttonContentStyle = `color: rgb(101, 119, 134);
font-size: 12px;
const buttonContentStyleCommon = `font-size: 12px;
font-weight: bold;
margin-left: 6px;
position: relative;`;
const buttonContentStyle = `${buttonContentStyleCommon} color: rgb(101, 119, 134);`;
const buttonContentStyleHover = `${buttonContentStyleCommon} color: #2a9cff;`;

const buttonContentStyleHover = `color: #2a9cff;
font-size: 12px;
font-weight: bold;
margin-left: 6px;
position: relative;`;

const buttonStyles = `background: transparent;
border:none; cursor: pointer;
color:rgb(101, 119, 134);
outline:none;`;

const buttonStylesHover = `background: transparent;
border:none; cursor: pointer;
color: #2a9cff;
const buttonStyleCommon = `background: transparent;
border:none; cursor: pointer; padding: 0px;
outline:none;`;
const buttonStyle = `${buttonStyleCommon} color:rgb(101, 119, 134);`;
const buttonStyleHover = `${buttonStyleCommon} color: #2a9cff;`;

const getTweetId = tweet => {
const status = tweet.querySelector("a[href*='/status/']");
if (!status || !status.href) {
return null;
}

return status.href.split('/retweets')[0];
return status.href.match('.*/status/[0-9]+')[0];
};

const createSuperheroTipAction = (tweet, tweetId, numActions) => {
const createSuperheroTipAction = tweetId => {
// Create the tip action
const hasUserActions = numActions > 3;
const superheroTipAction = document.createElement('div');
superheroTipAction.className = 'action-superhero-tip';
superheroTipAction.style.display = 'inline-block';
superheroTipAction.style.minWidth = '80px';
superheroTipAction.style.alignSelf = 'center';
superheroTipAction.style.textAlign = hasUserActions ? 'right' : 'start';
superheroTipAction.setAttribute('role', 'button');
superheroTipAction.setAttribute('tabindex', '0');

Expand All @@ -61,7 +47,7 @@ const createSuperheroTipAction = (tweet, tweetId, numActions) => {

// Create the tip button
const superheroTipButton = document.createElement('button');
superheroTipButton.setAttribute('style', buttonStyles);
superheroTipButton.setAttribute('style', buttonStyle);
superheroTipButton.appendChild(buttonIcon);
superheroTipButton.appendChild(buttonContent);

Expand All @@ -74,13 +60,13 @@ const createSuperheroTipAction = (tweet, tweetId, numActions) => {

const hoverEnter = () => {
buttonIcon.src = iconHover;
superheroTipButton.setAttribute('style', buttonStylesHover);
superheroTipButton.setAttribute('style', buttonStyleHover);
buttonContent.setAttribute('style', buttonContentStyleHover);
};

const hoverLeave = () => {
buttonIcon.src = icon;
superheroTipButton.setAttribute('style', buttonStyles);
superheroTipButton.setAttribute('style', buttonStyle);
buttonContent.setAttribute('style', buttonContentStyle);
};

Expand Down Expand Up @@ -116,21 +102,29 @@ const configureSuperheroTipAction = async () => {
'[data-testid="tweet"], [data-testid="tweetDetail"], [data-testid="tweet"] + div, [data-testid="tweetDetail"] + div',
);

// eslint-disable-next-line no-plusplus
for (let i = 0; i < tweets.length; ++i) {
const tweetId = getTweetId(tweets[i]);
if (!tweetId) continue;
const actions = tweets[i].querySelector('[role="group"]');
if (!actions) continue;
const numActions = actions.querySelectorAll(':scope > div').length || 0;
let bigTweetSkipped = !document.querySelectorAll('div[aria-label="Timeline: Conversation"]')
.length;
tweets.forEach(tweet => {
const tweetId = getTweetId(tweet);
if (!tweetId) return;
const actions = tweet.querySelector('[role="group"]');
if (!actions) return;
const lastActionNode = actions.querySelector(
':scope > div:not(.action-superhero-tip):last-child',
);
if (check && bigTweetSkipped && lastActionNode) {
lastActionNode.style.flexBasis = '0px';
lastActionNode.style.flexGrow = '1';
}
const superheroTipActions = actions.getElementsByClassName('action-superhero-tip');

if (check && superheroTipActions.length === 0) {
actions.appendChild(createSuperheroTipAction(tweets[i], tweetId, numActions));
actions.appendChild(createSuperheroTipAction(tweetId));
} else if (!check && superheroTipActions.length === 1) {
actions.removeChild(superheroTipActions[0]);
}
}
bigTweetSkipped = true;
});
timeout = setTimeout(configureSuperheroTipAction, 3000);
};

Expand Down
14 changes: 14 additions & 0 deletions src/icons/iframe/appStore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/icons/iframe/checkbox-checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/icons/iframe/checkbox-unchecked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions src/icons/iframe/firefox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/icons/iframe/google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

2 comments on commit 8f417f4

@davidyuk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidyuk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.