Skip to content

Commit

Permalink
1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hoothin committed Nov 8, 2023
1 parent b3ef69a commit 47a664d
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "1.6.30.30";
export const version = "1.7.1";
15 changes: 12 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ window.setLang = (_lang) => {
hideNotMatch: '非当前引擎则隐藏该项',
typeMatchTips: '仅在匹配站点显示该分组',
siteUrlTips: '%s 查询词; %t 目标链接; %u 页面地址; %h 页面域名',
customSize: '缩放工具栏/磁贴/拖拽圆盘',
customSize: '缩放工具栏/磁贴',
zoomDrag: '缩放拖拽圆盘',
typeOpenTime: '分组展开耗时',
longPressTime: '长按时间',
typeShotcut: '批量打开快捷键',
Expand Down Expand Up @@ -255,6 +256,8 @@ window.setLang = (_lang) => {
minPopupInput: '仅在输入框上启用',
hidePopup: '禁用搜索磁贴',
hidePopupTips: '开启后,划词磁贴将会禁用,划词时以完整搜索条取代',
numPerLine: '磁贴每行引擎数',
numPerLineTips: '设置磁贴每一行显示的引擎数量',
limitPopupLen: '划词磁贴字数限制',
limitPopupLenTips: '当划选文字长度小于此字数时不显示磁贴',
hideOnSearchEngine: '在搜索引擎页面隐藏',
Expand Down Expand Up @@ -437,7 +440,8 @@ window.setLang = (_lang) => {
hideNotMatch: '非當前引擎則隱藏該項',
typeMatchTips: '僅在匹配站點顯示該分組',
siteUrlTips: '%s 查詢詞; %t 目標連結; %u 頁面地址; %h 頁面域名',
customSize: '縮放工具欄/磁貼/拖曳圓盤',
customSize: '縮放工具欄/磁貼',
zoomDrag: '縮放拖曳圓盤',
typeOpenTime: '分組展開耗時',
longPressTime: '長按時間',
typeShotcut: '批量打開快捷鍵',
Expand Down Expand Up @@ -549,6 +553,8 @@ window.setLang = (_lang) => {
minPopupInput: '僅在輸入框上啓用',
hidePopup: '禁用搜尋磁貼',
hidePopupTips: '開啟後,劃詞磁貼將會禁用,劃詞時以完整搜尋條取代',
numPerLine: '磁貼每行引擎數',
numPerLineTips: '設定磁貼每一行顯示的引擎數量',
limitPopupLen: '劃詞磁貼字數限制',
limitPopupLenTips: '當劃選文字長度小於此字數時不顯示磁貼彈框',
hideOnSearchEngine: '在搜尋引擎頁面隱藏',
Expand Down Expand Up @@ -730,7 +736,8 @@ window.setLang = (_lang) => {
hideNotMatch: 'Hide if not current',
typeMatchTips: 'Show this category only when url matches',
siteUrlTips: '%s keywords; %t target URL; %u site URL; %h hostname',
customSize: 'Zoom toolbar/tiles/disc',
customSize: 'Zoom toolbar/tiles',
zoomDrag: 'Zoom drag disc',
typeOpenTime: 'Category expansion time',
longPressTime: 'Long press time',
typeShotcut: 'Shortcut for batch open',
Expand Down Expand Up @@ -842,6 +849,8 @@ window.setLang = (_lang) => {
minPopupInput: 'Only on input',
hidePopup: 'Disable search popup',
hidePopupTips: 'After opening, the popup box will be disabled, and the full search bar will be used to replace it',
numPerLine: 'Number of engines per line of tile',
numPerLineTips: 'Set the number of engines displayed in each line of the tile',
limitPopupLen: 'Limit words for popup',
limitPopupLenTips: 'No popup box when length of selected words is less than this',
hideOnSearchEngine: 'Hide on search engine page',
Expand Down
108 changes: 108 additions & 0 deletions src/page/General.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export default function General() {
if (!window.searchData.prefConfig.customSize) {
window.searchData.prefConfig.customSize = 100;
}
if (!window.searchData.prefConfig.zoomDrag) {
window.searchData.prefConfig.zoomDrag = 100;
}
if (!window.searchData.prefConfig.longPressTime) {
window.searchData.prefConfig.longPressTime = 500;
}
Expand Down Expand Up @@ -114,6 +117,9 @@ export default function General() {
if (typeof window.searchData.prefConfig.currentTypeFirst === "undefined") {
window.searchData.prefConfig.currentTypeFirst = true;
}
if (typeof window.searchData.prefConfig.numPerLine === "undefined") {
window.searchData.prefConfig.numPerLine = 7;
}
const [state, setState] = React.useState(
window.searchData.prefConfig
);
Expand Down Expand Up @@ -328,6 +334,76 @@ export default function General() {
}}
/>
</Box>
<Typography gutterBottom component="div">
<h4>{window.i18n('zoomDrag')}: {state.zoomDrag}%</h4>
</Typography>
<Box
sx={{ flexGrow: 1, bgcolor: 'background.paper', display: 'flex', width: '100%', flexWrap: 'wrap' }}
>
<Box sx={{ width: "75%", ml: "10px", mr: "20px", mt: "15px"}}>
<Slider
value={state.zoomDrag}
onChange={(event: Event, newValue: number | number[]) => {
if (newValue > 500) {
newValue = 500;
} else if (newValue < 50) {
newValue = 50;
}
var newPref = {
...state,
zoomDrag: newValue
};
setState(newPref);
window.searchData.prefConfig = newPref;
saveConfigToScript();
}}
sx={{mt:"-8px"}}
aria-labelledby="input-slider"
min={50}
max={500}
step={10}
valueLabelDisplay="auto"
marks={[{
value: 100,
label: '100%',
},{
value: 500,
label: '500%',
}]}
/>
</Box>
<TextField
sx={{ m: 1, minWidth: 100, width: "15%"}}
label={window.i18n('zoomDrag')}
InputProps={{
inputMode: 'numeric', type:'number', pattern: '[0-9]*',
endAdornment: <InputAdornment position="end">%</InputAdornment>
}}
value={state.zoomDrag}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
var newPref = {
...state,
zoomDrag: event.target.value
};
setState(newPref);
}}
onBlur={e => {
let newValue = parseInt(e.target.value);
if (newValue > 500) {
newValue = 500;
} else if (newValue < 50) {
newValue = 50;
}
var newPref = {
...state,
zoomDrag: newValue
};
setState(newPref);
window.searchData.prefConfig = newPref;
saveConfigToScript();
}}
/>
</Box>
</Paper>
<Paper elevation={5} sx={{ padding: '20px', marginTop: '20px' }}>
<Box
Expand Down Expand Up @@ -1427,6 +1503,38 @@ export default function General() {
{window.i18n('limitPopupLenTips')}
</Typography>
</Box>
<Typography gutterBottom component="div">
<h4>{window.i18n('numPerLine')}</h4>
</Typography>
<Box
sx={{ flexGrow: 1, display: 'flex', width: '100%', flexWrap: 'wrap' }}
>
<TextField
sx={{ width: 70, margin: '8px' }}
label={"Length"}
inputProps={{ inputMode: 'numeric', type:'number', pattern: '[0-9]*' }}
value={state.numPerLine}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
let newValue = parseInt(event.target.value);
if (newValue < 1) {
newValue = 1;
}
if (newValue > 50) {
newValue = 50;
}
var newPref = {
...state,
numPerLine: newValue
};
setState(newPref);
window.searchData.prefConfig = newPref;
saveConfigToScript();
}}
/>
<Typography gutterBottom component="div" sx={{ marginTop: '20px' }}>
{window.i18n('numPerLineTips')}
</Typography>
</Box>
<Box sx={{ flexGrow: 1, display: 'flex'}}>
<Box>
<Typography gutterBottom component="div">
Expand Down

0 comments on commit 47a664d

Please sign in to comment.