Skip to content

Commit

Permalink
add script to clear undesired js
Browse files Browse the repository at this point in the history
  • Loading branch information
monro93 committed Aug 13, 2024
1 parent 556c282 commit 2462fae
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "gpl-2.0",
"scripts": {
"start": "webpack serve --mode development",
"build": "webpack --mode production",
"build": "webpack --mode production && src/scripts/clear_js.sh",
"test": "jest",
"lint": "eslint src"
},
Expand Down
9 changes: 8 additions & 1 deletion src/App/SearchParamsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ const isEqual = require('lodash.isequal');
const { withCoreSuspender, useProfile, useToast } = require('stremio/common');
const { useServices } = require('stremio/services');

function fromEntries (iterable) {
return [...iterable].reduce((obj, [key, val]) => {
obj[key] = val;
return obj;
}, {});
}

const SearchParamsHandler = () => {
const { core } = useServices();
const profile = useProfile();
Expand All @@ -17,7 +24,7 @@ const SearchParamsHandler = () => {
const { searchParams } = new URL(`${origin}${hash.replace('#', '')}${search}`);

setSearchParams((previousSearchParams) => {
const currentSearchParams = Object.fromEntries(searchParams.entries());
const currentSearchParams = fromEntries(searchParams.entries());
return isEqual(previousSearchParams, currentSearchParams) ? previousSearchParams : currentSearchParams;
});
};
Expand Down
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ const { initReactI18next } = require('react-i18next');
const stremioTranslations = require('stremio-translations');
const App = require('./App');

const translations = Object.fromEntries(Object.entries(stremioTranslations()).map(([key, value]) => [key, {
function fromEntries (iterable) {
return [...iterable].reduce((obj, [key, val]) => {
obj[key] = val;
return obj;
}, {});
}

const translations = fromEntries(Object.entries(stremioTranslations()).map(([key, value]) => [key, {
translation: value
}]));

Expand Down
11 changes: 6 additions & 5 deletions src/routes/MetaDetails/VideosList/Video/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
event.preventDefault();
}
}, [toggleMenu]);
const popupLabelOnLongPress = React.useCallback((event) => {
if (event.nativeEvent.pointerType !== 'mouse' && !event.nativeEvent.togglePopupPrevented) {
toggleMenu();
}
}, [toggleMenu]);
const popupLabelOnLongPress = undefined
// const popupLabelOnLongPress = React.useCallback((event) => {
// if (event.nativeEvent.pointerType !== 'mouse' && !event.nativeEvent.togglePopupPrevented) {
// toggleMenu();
// }
// }, [toggleMenu]);
const popupMenuOnPointerDown = React.useCallback((event) => {
event.nativeEvent.togglePopupPrevented = true;
}, []);
Expand Down
10 changes: 10 additions & 0 deletions src/scripts/clear_js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

COMMIT=556c282ce8fddd802fb5bf0ebc77ae0edcda6173
JS_FILE=./build/$COMMIT/scripts/main.js
echo "cleaning file $JS_FILE"
sed -i '' 's/window\?\.PointerEvent/window.PointerEvent/g' $JS_FILE
sed -i '' 's/window\?\.TouchEvent/window\.TouchEvent/g' $JS_FILE
#sed -i '' 's/s\?\.(a/s(a/g' $JS_FILE
#sed -i '' 's/u\?\.(t/u(t/g' $JS_FILE
#sed -i '' 's/A\?\.(t/A(t/g' $JS_FILE
#sed -i '' 's/I\?\.(t/I(t/g' $JS_FILE
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const COMMIT_HASH = execSync('git rev-parse HEAD').toString().trim();

module.exports = (env, argv) => ({
mode: argv.mode,
target: ["web", "es5"],
devtool: argv.mode === 'production' ? 'source-map' : 'eval-source-map',
entry: {
main: './src/index.js',
Expand Down

0 comments on commit 2462fae

Please sign in to comment.