I’m trying to implement a simple tamper monkey script in my firefox browser that searches a current window (containing lines of debug logs) for a url, then open this url using window.open(url, '_blank'); in a new tab. Now this works perfectly fine. However, the next part is what I’m finding a bit hard; I’d like to have the new window open to a specific coordinates where a certain string exists, similar to opening a url and then pressing crtl + F and typign the string in the search bar. I know window.find(str); works but when I use it, it search for the str in my current tab not the newly opened tab
Category: javascript
Category Added in a WPeMatico Campaign
How can I sort, then filter in 11ty using .addCollection and the Collection API methods?
For context for the examples used, I’m using 11ty to make a website that catalogues and taxonomizes comic book sound effects.
Regarding my question, each sound effect has the following relevant front matter types:
---
sfxName: Boom
tags: sfx
sfxCategory:
- comedic
- neutral
sfxSource:
- impact
sfxPitch:
- low
sfxWeight:
- hollow
sfxRhythm:
- beat
eleventyComputed:
title: {{sfxName}}
---
I call these sound effects in groups on certain pages using filtered shortcode that includes sound effects based on front-matter data. (sfxCategory, sfxSource, sfxPitch, etc.)
{% set wordList = collections.sfx | taxonomy("data.sfxCategory", "comedic") %}
{% for word in wordList %}
<a href="{{word.filePathStem}}"><li>{{word.data.sfxName}}</li></a>
{% endfor %}
The problem arises when I attempt to sort these alphabetically by sfxName. I’m doing this by trying to make a new, sorted collection sortedSfx from sfx in the Eleventy Configuration file.
//eleventy.config.js
// Sort, then filter
eleventyConfig.addCollection("sortedSfx", function (collectionsApi) {
return collectionsApi.getFilteredByTag("sfx").sort(function (a, b) {
return a.data.sfxName - b.data.sfxName;
});
});
//page.njk
{% set wordList = collections.sortedSfx | taxonomy("data.sfxCategory", "comedic") %}
{% for word in wordList %}
<a href="{{word.filePathStem}}"><li>{{word.data.sfxName}}</li></a>
{% endfor %}
Something is awry with that code ⬆️. It renders items in chronological file-date order, which is what Eleventy defaults to. Resulting in “Bonk, Bam, Boom, Bing”.
Running a .getAll().sort works as intended, but I will soon have other collections than just sfx. I think there are shortcode filters to sort with, but I am using my custom taxonomy filter in the shortcode for something else. I assume .getFilterByTag() is also working as intended, though I haven’t added any other post types to prove myself wrong with yet.
// Sort (Result: Bam, Bing, Bonk, Boom ✅)
eleventyConfig.addCollection("sortAlphaAscend", function (collectionsApi) {
return collectionsApi.getAll().sort(function (a, b) {
return a.data.sfxName - b.data.sfxName;
});
});
// Filter (Result: Bonk, Bam, Boom, Bing [The order I made them in.] ✅)
eleventyConfig.addCollection("justSfx", function (collectionsApi) {
return collectionsApi.getFilteredByTag("sfx");
});
Both examples are 1:1 with those provided in the 11ty docs. It’s in attempting to combine a Sort, and a Filter where things go wrong, with the result falling back to 11ty’s chronological default. I am using a seemingly successful attempt by Michael Oldroyd in 2019 as reference.
Here’s my non-working code again:
//eleventy.config.js
// Sort, then filter (Result: Bonk, Bam, Boom, Bing [The order I made them in, 11ty's fallback default.] ❌)
eleventyConfig.addCollection("sortedSfx", function (collectionsApi) {
return collectionsApi.getFilteredByTag("sfx").sort(function (a, b) {
return a.data.sfxName - b.data.sfxName;
});
});
How to I get the sort and filter to combine properly?
trying to generate same minified script using webpack with uglify-js and pure uglify-js
Today I use a docker image that runs uglify-js v3.19.3 on several scripts with the following options
-m -c
where -m is for mangle and -c is for compression (like described here https://www.npmjs.com/package/uglify-js )
now I want to use webpack on this project and I see that there is a plugin to minify using uglify-js, I’d like to reuse some common code as modules but I still need to generate bundled / minified javascript.
my first attempt is to be able to generate the SAME compressed file, and it generates the same js EXCEPT for a single change.
using webpack I have the following start:
(()=>{{var m=window,p=document;/*the rest of the code*/
while using uglify-js directly I have
((m,p)=>{/*the rest of the code*/})(window,document);
This differente is not a big deal, however I’d like to understant the root cause of this change. I think will be easier introduce this new workflow if I show that the current minified scripts can be regenerated in the same way
my package.json
{
"name": "poc",
"version": "1.0.0",
"private": true,
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"raw-loader": "^4.0.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.99.9",
"webpack-cli": "^6.0.1"
}
}
and my webpack.config.js
const webpack = require('webpack');
const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
entry: './src/xxx/index.js',
mode: 'none',
// mode: 'production', // This does not affect the output
output: {
path: path.resolve(__dirname, 'dist', 'xxx'),
filename: 'index.min.js',
},
plugins: [
new webpack.ProgressPlugin(),
],
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
minify: TerserPlugin.uglifyJsMinify,
terserOptions: {
mangle: true,
compress: true,
},
})],
},
};
my source code is
(function (window, document) {
/* code */
})(window, document);
as you can see, I am forcing pass window and document as arguments because at some point this was a hint to help the minifier to compress even more.
I think there is some sort configuration that I need to change to be possible generate the same minified file, but I could not find anything. perhaps this is the webpack itself?
Javascript in Visual studio 2022 [closed]
I’ve been working in Visual Studio 2022 (NOT Code) using the JavaScript language. I managed to create a template that allowed me to write in JavaScript, since Visual Studio doesn’t include it as a default language. I recently changed computers, and the template disappeared, and now I can’t manage to create a new one. Do you know how to do it, or do you have a ready-made template I could use? I do not want to work in Visual Studio Code.
How to track PayPal button pressed on site?
I have Ubuntu server with Apache, Mysql, php installed and wordpress site working on it.
I add paypal button on site with copypasting that script, provided by paypal:
<div id="paypal-container-NQBTQQ89BA6A6"></div>
<script>
paypal.HostedButtons({
hostedButtonId: "NQBTQQ89BA6A6",
}).render("#paypal-container-NQBTQQ89BA6A6")
</script>
So there is a button on site and it works when you press it with mouse.
Question is simple – how I can track visitor clicked the button? Better in simplest way with any JS or PHP code (or any other way), let say write “button clicked” to the server file or send any notification etc.
How to make elements shift smooth when another element is added?
I have a list of cards that are div elements inside a flexbox div container. When I drag an element, I change its position in container with insertBefore() function. So to make it simple, I just add an element into a collection between other elements. What I need is to make other elements to shift smoothly, now they just like teleport in one frame, but want them to shift with smooth animation. I thought I could do it with transition or animation but I don’t know what to animate.
How to remove next js version from Wappalyzer
I have next js application i want to remove next js version from wappalyzer
Things i have tried
in my next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: "standalone",
images: {
domains: [
"smc-static-website-artifact-uat.s3.amazonaws.com", // Add this domain
// Add any other domains you need here
],
},
experimental: {
missingSuspenseWithCSRBailout: false,
},
eslint: {
// This allows production builds to successfully complete even if there are ESLint errors.
ignoreDuringBuilds: true,
},
typescript: {
// Ignore TypeScript errors during build
ignoreBuildErrors: true,
},
reactStrictMode: true,
poweredByHeader: false,
async headers() {
return [
{
source: "/:path*",
headers: [
{
key: 'X-Powered-By',
value: '',
},
],
},
];
},
compiler: {
removeConsole: {
exclude: ["error"], // Keep only console.error
},
},
};
module.exports = nextConfig;
In header I added key as X-Powered-By and value ”
Another thing i did is
by changing the next.config.js
/** @type {import('next').NextConfig} */
const webpack = require("webpack");
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: "standalone",
images: {
domains: [
"smc-static-website-artifact-uat.s3.amazonaws.com",
],
},
experimental: {
missingSuspenseWithCSRBailout: false,
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
poweredByHeader: false,
async headers() {
return [
{
source: "/:path*",
headers: [
{ key: "Server", value: "" },
{ key: "X-Frame-Options", value: "DENY" },
{
key: "Set-Cookie",
value: "cookie=value; HttpOnly=true; Secure=true; SameSite=Strict",
},
{ key: "Allow", value: "GET, POST" },
{ key: "Access-Control-Allow-Methods", value: "GET, POST" },
{ key: "X-HTTP-Method-Override", value: "GET, POST" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-XSS-Protection", value: "1; mode=block" },
{
key: "Strict-Transport-Security",
value: "max-age=31536000; includeSubDomains",
},
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "X-Powered-By", value: "" },
{
key: "Cache-Control",
value: "no-store, no-cache, must-revalidate, proxy-revalidate",
},
],
},
];
},
compiler: {
removeConsole: {
exclude: ["error"],
},
},
// ✅ Add webpack customization to remove version info
webpack(config, { isServer }) {
if (!isServer) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/next/dist/client/index.js/,
require.resolve("./remove-next-version.js")
)
);
}
return config;
},
};
module.exports = nextConfig;
created remove-next-version.js in the root of the application
module.exports = {
version: '',
appDir: false,
};
Still in wapplyzer the next js version is visible
I want to next js version to be empty
React Fullcalendar Premium version [closed]
I am using FullCalendar library. I want to use FullCalendar free version. I wrote the codes below. But I didn’t understand whether it was a paid or free version. Are these codes paid or free? I want to do it using the completely free version. Are the codes I wrote the free version?
In short, what I want is to do it using the completely free version. Are the codes I wrote completely free?
import { useState, useEffect } from 'react'; import FullCalendar from '@fullcalendar/react'; import timeGridPlugin from '@fullcalendar/timegrid'; import interactionPlugin from '@fullcalendar/interaction'; import { Modal, Box, Button, TextField, Typography, MenuItem, Select, InputLabel, FormControl, FormControlLabel, Switch } from '@mui/material'; import allLocales from '@fullcalendar/core/locales-all' import dayGridPlugin from '@fullcalendar/daygrid';
const App = () => { const [events, setEvents] = useState([{
id: '1',
title: 'Örnek Aktivite',
start: '2025-06-23T10:00:00Z',
end: '2025-06-23T12:00:00Z',
description: 'Bir örnek etkinlik',
category: 'Toplantı' }]);
const [modalOpen, setModalOpen] = useState(false); const [currentDate, setCurrentDate] = useState(null); const [selectedEvent, setSelectedEvent] = useState(null); const [isEditing, setIsEditing] = useState(false); const [currentView, setCurrentView] = useState('timeGridWeek'); const [isMonthlyView, setIsMonthlyView] = useState(false);
const addEvent = (eventData, isEditing) => {
if (isEditing) {
setEvents(events.map((event) =>
event.id === selectedEvent.id ? { ...event, ...eventData } : event
));
} else {
setEvents([...events, eventData]);
} };
const handleDateClick = (arg) => {
setCurrentDate(arg.dateStr);
setSelectedEvent(null);
setIsEditing(false);
setModalOpen(true); };
const handleEventClick = (arg) => {
setCurrentDate(arg.event.startStr);
setSelectedEvent(arg.event);
setIsEditing(true);
setModalOpen(true); };
const handleSwitchChange = (event) => {
setIsMonthlyView(event.target.checked);
setCurrentView(event.target.checked ? 'dayGridMonth' : 'timeGridWeek'); };
return (
<div>
<FormControlLabel
control={<Switch checked={isMonthlyView} onChange={handleSwitchChange} />}
label={isMonthlyView ? "Aylık Görünüm" : "Haftalık Görünüm"}
/>
<FullCalendar
key={currentView}
plugins={[timeGridPlugin, interactionPlugin, dayGridPlugin]}
//initialView="timeGridWeek"
initialView={currentView}
weekends={false}
editable={true}
selectable={true}
dateClick={handleDateClick}
eventClick={handleEventClick}
events={events}
eventTimeFormat={{
hour: '2-digit',
minute: '2-digit',
hour12: false,
}}
slotLabelFormat={{
hour: '2-digit',
minute: '2-digit',
hour12: false
}}
timeZone="UTC"
locales={allLocales}
locale="tr"
/>
<EventModal
isOpen={modalOpen}
onClose={() => setModalOpen(false)}
onSave={addEvent}
currentDate={currentDate}
selectedEvent={selectedEvent}
isEditing={isEditing}
/>
</div> ); };
const EventModal = ({ isOpen, onClose, onSave, currentDate, selectedEvent, isEditing }) => { const [title, setTitle] = useState(''); const [description, setDescription] = useState(''); const [category, setCategory] = useState(''); const [startTime, setStartTime] = useState(''); const [endTime, setEndTime] = useState('');
useEffect(() => {
if (selectedEvent) {
setTitle(selectedEvent.title || '');
setDescription(selectedEvent.extendedProps?.description || '');
setCategory(selectedEvent.extendedProps?.category || '');
const startDate = new Date(selectedEvent.start);
const endDate = new Date(selectedEvent.end);
setStartTime(startDate.toISOString().substring(11, 16) || '');
setEndTime(endDate.toISOString().substring(11, 16) || '');
} else {
setTitle('');
setDescription('');
setCategory('');
setStartTime('');
setEndTime('');
} }, [selectedEvent]);
const handleSave = () => {
if (title && description && category && startTime && endTime) {
const currentDateOnly = currentDate.split('T')[0];
const startDateTimeString = `${currentDateOnly}T${startTime}:00`;
const endDateTimeString = `${currentDateOnly}T${endTime}:00`;
const startDateTime = new Date(startDateTimeString);
const endDateTime = new Date(endDateTimeString);
if (isNaN(startDateTime.getTime()) || isNaN(endDateTime.getTime())) {
alert('Geçersiz tarih veya saat formatı!');
return;
}
const startDateTimeLocal = new Date(startDateTime.getTime() - startDateTime.getTimezoneOffset() * 60000);
const endDateTimeLocal = new Date(endDateTime.getTime() - endDateTime.getTimezoneOffset() * 60000);
const startDateTimeISOString = startDateTimeLocal.toISOString();
const endDateTimeISOString = endDateTimeLocal.toISOString();
const eventData = {
id: selectedEvent ? selectedEvent.id : Date.now().toString(),
title,
start: startDateTimeISOString,
end: endDateTimeISOString,
description,
category
};
onSave(eventData, isEditing);
onClose();
} else {
alert('Lütfen tüm alanları doldurun.');
} };
useEffect(() => {
if (!isOpen) {
setTitle('');
setDescription('');
setCategory('');
setStartTime('');
setEndTime('');
} }, [isOpen]);
return (
<Modal open={isOpen} onClose={onClose}>
<Box
sx={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
bgcolor: 'background.paper',
borderRadius: '8px',
boxShadow: 24,
p: 4,
outline: 'none',
}}
>
<Typography variant="h6" gutterBottom>
{isEditing ? 'Etkinlik Düzenle' : 'Yeni Etkinlik Ekle'}
</Typography>
<TextField
label="Başlık"
fullWidth
margin="normal"
value={title}
onChange={(e) => setTitle(e.target.value)}
/>
<TextField
label="Etkinlik Detayı"
fullWidth
multiline
rows={4}
margin="normal"
value={description}
onChange={(e) => setDescription(e.target.value)}
/>
<FormControl fullWidth margin="normal">
<InputLabel>Kategori</InputLabel>
<Select
value={category}
onChange={(e) => setCategory(e.target.value)}
label="Kategori"
>
<MenuItem value="Toplantı">Toplantı</MenuItem>
<MenuItem value="Seminer">Seminer</MenuItem>
<MenuItem value="Eğitim">Eğitim</MenuItem>
<MenuItem value="Diğer">Diğer</MenuItem>
</Select>
</FormControl>
<TextField
label="Başlangıç Saati"
type="time"
fullWidth
margin="normal"
value={startTime}
onChange={(e) => setStartTime(e.target.value)}
/>
<TextField
label="Bitiş Saati"
type="time"
fullWidth
margin="normal"
value={endTime}
onChange={(e) => setEndTime(e.target.value)}
/>
<Box sx={{ mt: 2 }}>
<Button variant="contained" color="primary" onClick={handleSave} sx={{ mr: 2 }}>
{isEditing ? 'Güncelle' : 'Kaydet'}
</Button>
<Button variant="outlined" color="secondary" onClick={onClose}>
Kapat
</Button>
</Box>
</Box>
</Modal> ); };
export default App;
i am creating a next app and while using framer i get this error [closed]
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports.
i tryed and using “use client” worked it out
spinner is creating problem in rc-table in reactjs
There are 2 issue i’m facing while using rc-table
-
I’m using rc-table and showing spinner till get the response from api . spinner is flickering in loading for a mili second.
-
this class rc-table-cell.rc-table-cell-scrollbar is getting added by deafult in column header. when data is there while in laoding state it is not there, so cloumn header slightly jump left and right every there after loading.
npm Rc-table https://www.npmjs.com/package/rc-table
<Table
style={style}
rowClassName={rowClassName}
columns={columns}
data={data}
rowKey={rowKey}
scroll={scroll}
emptyText={showLoader ? <SpinnerWrapper><TableSpinner /> </SpinnerWrapper> : noDataTite}
/>
How to add textures to antv/g2 pie charts
I’ve a pie chart created with javascript in React with antv/g2 but for Accessibility compliance I must add some textures (like dots and lines) for people with color blindness.
I’ve tried everything from svg to antv/g and antv/g-pattern but it doesn’t work.
Here’s the code that creates the pie chart:
renderPieChart = (data, transformedData) => {
const { id, height } = this.state;
const container = document.getElementById(id);
if (!container) return;
const chart = new Chart({
container: id,
autoFit: true,
height: height.pie,
});
this.setState({ chart });
// Imposta il raggio in base alla dimensione dello schermo
const radius = this.getChartRadius();
chart.coordinate("theta", { radius });
chart.data(data);
chart.tooltip({ showTitle: false, showMarkers: false });
chart.legend(false);
const colorMap = this.createColorMap(transformedData);
const getColor = (value) => this.resolveColor(value, data, colorMap);
chart
.interval()
.position("totale")
.color("tipologiaTest", getColor)
.label("tipologiaTest*totale", this.getLabelConfig())
.adjust("stack");
chart.render();
};
Do you know some easy way to do that keeping this library or changing with an easier library? Thank you
Sublime text terminal windows [duplicate]
I want to post code on git hub and dont know how to access terminal on sublime text
I havent really tried anything im asking to know how to go about it. It is kind of challenging since on vs code accessing the terminal is kinda easy how do i really gp round it
Array of objects data manipulation through a custom renderer ReactJs
Trying to manipulate the data inside cell the data is [{code: R01, amount: 900}, {code: R02, amount: 10}].
So when I try to manipulate this data using the code as
const final = currentValues.map(v => ({
code: v.code,
amount: parseFloat(v.amount) || 0,
}));
instance.setDataAtRowProp(row, "reason_code", [...final]);
This does not get updated , same method works on the string.
Let me know possible solutions
ReactJS
Parent comp (has data through GET)
One reusable comp has handsontable,
Renderer is vanillaJS
RTK Query checkAuth not working immediately after login
I have a question.
I’m using RTK Query to check authentication. When I log in, it doesn’t navigate me to the Home page. If I temporarily remove the if condition that checks for authentication, it goes to the home page, but the checkAuth doesn’t work.
However, if I refresh the page, the checkAuth works.
Also, if I remove the skipToken option, I immediately get an error upon login, saying ‘no token provided.’
How can I fix this?”
import toast from "react-hot-toast";
import { useEffect } from "react";
import { Navigate, useNavigate } from "react-router-dom";
import { useSelector, useDispatch } from "react-redux";
import { skipToken } from "@reduxjs/toolkit/query";
import { useCheckAuthQuery, useLogoutMutation } from "../services/auth.js";
import { logout, updateUser } from "../app/features/auth.js";
const AuthProvider = ({ children }) => {
const dispatch = useDispatch();
const navigate = useNavigate();
const token = useSelector(
(state) => state.auth.token || localStorage.getItem("token"),
);
const { data, isSuccess, isLoading, error, isError } = useCheckAuthQuery(
token ? undefined : skipToken,
);
const [logoutMutation] = useLogoutMutation();
useEffect(() => {
if (isSuccess && data) {
dispatch(updateUser(data));
toast.success(data?.message);
navigate("/");
}
if (data?.user.isVerified === false) {
navigate("/verifyEmail");
}
}, [isSuccess, data, dispatch]);
useEffect(() => {
if (isError && error) {
toast.error(error?.data?.message || "Failure");
dispatch(logout());
logoutMutation();
navigate("/login");
}
}, [error, isError, dispatch]);
if (isLoading) {
return (
<div className='h-full flex justify-center items-center'>
Checking authentication ...
</div>
);
}
if (!token) {
return <Navigate to='/login' />;
}
return children;
};
export default AuthProvider;
Are there any modern React Native markdown renderers that fully support GFM?
I’ve noticed that most answers about React Native markdown renderers are quite old—many from 5 to 9 years ago—and rely on outdated libraries or approaches.
Is there any modern, actively maintained React Native markdown library that fully supports GitHub Flavored Markdown and allows customization/extensibility?
I’ve tried react-native-markdown-display, but it doesn’t support full GFM, has issues like no horizontal scrolling for tables, limited tag support, and it’s not actively maintained.
Really hoping for some fresh options or recommendations!!!


