Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
ace0c783
Commit
ace0c783
authored
Jul 16, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jul 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11669 from gitama2023/patch-1
Added a prompt for users using poor scaling
parents
570f42af
f4391796
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
0 deletions
+108
-0
javascript/badScaleChecker.js
javascript/badScaleChecker.js
+108
-0
No files found.
javascript/badScaleChecker.js
0 → 100644
View file @
ace0c783
(
function
()
{
var
ignore
=
localStorage
.
getItem
(
"
bad-scale-ignore-it
"
)
==
"
ignore-it
"
;
function
getScale
()
{
var
ratio
=
0
,
screen
=
window
.
screen
,
ua
=
navigator
.
userAgent
.
toLowerCase
();
if
(
window
.
devicePixelRatio
!==
undefined
)
{
ratio
=
window
.
devicePixelRatio
;
}
else
if
(
~
ua
.
indexOf
(
'
msie
'
))
{
if
(
screen
.
deviceXDPI
&&
screen
.
logicalXDPI
)
{
ratio
=
screen
.
deviceXDPI
/
screen
.
logicalXDPI
;
}
}
else
if
(
window
.
outerWidth
!==
undefined
&&
window
.
innerWidth
!==
undefined
)
{
ratio
=
window
.
outerWidth
/
window
.
innerWidth
;
}
return
ratio
==
0
?
0
:
Math
.
round
(
ratio
*
100
);
}
var
showing
=
false
;
var
div
=
document
.
createElement
(
"
div
"
);
div
.
style
.
position
=
"
fixed
"
;
div
.
style
.
top
=
"
0px
"
;
div
.
style
.
left
=
"
0px
"
;
div
.
style
.
width
=
"
100vw
"
;
div
.
style
.
backgroundColor
=
"
firebrick
"
;
div
.
style
.
textAlign
=
"
center
"
;
div
.
style
.
zIndex
=
99
;
var
b
=
document
.
createElement
(
"
b
"
);
b
.
innerHTML
=
'
Bad Scale: ??%
'
;
div
.
appendChild
(
b
);
var
note1
=
document
.
createElement
(
"
p
"
);
note1
.
innerHTML
=
"
Change your browser or your computer settings!
"
;
note1
.
title
=
'
Just make sure "computer-scale" * "browser-scale" = 100% ,
\n
'
+
"
you can keep your computer-scale and only change this page's scale,
\n
"
+
"
for example: your computer-scale is 125%, just use [
\"
CTRL
\"
+
\"
-
\"
] to make your browser-scale of this page to 80%.
"
;
div
.
appendChild
(
note1
);
var
note2
=
document
.
createElement
(
"
p
"
);
note2
.
innerHTML
=
"
Otherwise, it will cause this page to not function properly!
"
;
note2
.
title
=
"
When you click
\"
Copy image to: [inpaint sketch]
\"
in some img2img's tab,
\n
"
+
"
if scale<100% the canvas will be invisible,
\n
"
+
"
else if scale>100% this page will take large amount of memory and CPU performance.
"
;
div
.
appendChild
(
note2
);
var
btn
=
document
.
createElement
(
"
button
"
);
btn
.
innerHTML
=
"
Click here to ignore
"
;
div
.
appendChild
(
btn
);
function
tryShowTopBar
(
scale
)
{
if
(
showing
)
return
;
b
.
innerHTML
=
'
Bad Scale:
'
+
scale
+
'
%
'
;
var
updateScaleTimer
=
setInterval
(
function
()
{
var
newScale
=
getScale
();
b
.
innerHTML
=
'
Bad Scale:
'
+
newScale
+
'
%
'
;
if
(
newScale
==
100
)
{
var
p
=
div
.
parentNode
;
if
(
p
!=
null
)
p
.
removeChild
(
div
);
showing
=
false
;
clearInterval
(
updateScaleTimer
);
check
();
}
},
999
);
btn
.
onclick
=
function
()
{
clearInterval
(
updateScaleTimer
);
var
p
=
div
.
parentNode
;
if
(
p
!=
null
)
p
.
removeChild
(
div
);
ignore
=
true
;
showing
=
false
;
localStorage
.
setItem
(
"
bad-scale-ignore-it
"
,
"
ignore-it
"
);
};
document
.
body
.
appendChild
(
div
);
}
function
check
()
{
if
(
!
ignore
)
{
var
timer
=
setInterval
(
function
()
{
var
scale
=
getScale
();
if
(
scale
!=
100
&&
!
ignore
)
{
tryShowTopBar
(
scale
);
clearInterval
(
timer
);
}
if
(
ignore
)
{
clearInterval
(
timer
);
}
},
999
);
}
}
if
(
document
.
readyState
!=
"
complete
"
)
{
document
.
onreadystatechange
=
function
()
{
if
(
document
.
readyState
!=
"
complete
"
)
check
();
};
}
else
{
check
();
}
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment