add bingAI image creator

This commit is contained in:
James Feng Cao 2023-05-09 23:00:28 +08:00
parent a413b5f1d0
commit eb328d7609
15 changed files with 246 additions and 32 deletions

View file

@ -15,6 +15,7 @@
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Install bingWrite UI write.html for censored area (bingWrite)
Install bingAI image creator UI draw.html for censored area (bingAI image creator)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.</description>
</item>

View file

@ -15,6 +15,7 @@
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Install bingWrite UI write.html for censored area (bingWrite)
Install bingAI image creator UI draw.html for censored area (bingAI image creator)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.</description>
</item>

View file

@ -51,6 +51,7 @@
<h4 id="bingchat-ui">bingChat UI</h4>
<p><a href="i:0hsitecache/www.bing.com/ai.html:../searchurl/bingAI/bing.html">Install bingChat UI ai.html for censored area</a> (<a href="https://www.bing.com/ai.html">bingChat UI</a>)</p>
<p><a href="i:0hsitecache/www.bing.com/write.html:../searchurl/bingAI/write.html">Install bingWrite UI write.html for censored area</a> (<a href="https://www.bing.com/write.html">bingWrite</a>)</p>
<p><a href="i:0hsitecache/www.bing.com/draw.html:../searchurl/bingAI/draw.html">Install bingAI image creator UI draw.html for censored area</a> (<a href="https://www.bing.com/draw.html">bingAI image creator</a>)</p>
<h4 id="serverless-local-sites">Serverless local sites</h4>
<p><a href="i:01Extract webapp:i:0bsitecache/local/:">Click to install url service that extracts web apps to the folder &quot;sitecache/local/&quot;</a>: support web extensions (.crx for chrome &amp; .xpi for firefox).</p>
<p>Any folder under &quot;sitecache&quot; can be visited as a local site. Urls with search queries can be dynamically processed by the js/wasm code in the local file.</p>
@ -65,8 +66,8 @@
</div>
</div>
<p>Last Modified: 19 April 2023<br>
support .js files under &#39;css&#39; folder<br>
<p>Last Modified: 9 May 2023<br>
add init bingAI draw<br>
<pre></pre>
</p>
<script>

View file

@ -0,0 +1,205 @@
/* 头部分 */
body {
font-family: "Segoe UI", Arial, "Microsoft Yahei", sans-serif;
font-size: 75%;
}
#head {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 4rem;
display: flex;
align-items: center;
justify-content: space-between;
backdrop-filter: blur(10px);
background-color: #ffffff78;
z-index: 99;
}
#head-img-div {
height: 100%;
display: flex;
justify-content: flex-start;
align-items: center;
}
#head-img-div>img {
height: 100%;
}
#head-img-div-h2-img>* {
margin: 0;
}
#head-li-div {
display: flex;
flex-direction: row;
align-items: center;
}
#head-li-div>li {
list-style: none;
margin-right: 1rem;
font-size: 1rem;
}
#head-li-div>a {
display: inline-block;
list-style: none;
margin-right: 1rem;
font-size: 1rem;
color: inherit;
text-decoration: inherit;
}
#head-li-div>a:hover{
color: #ff8300;
}
/* 背景*/
#background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
background: repeating-linear-gradient(359deg, rgb(182 196 255) 0%, rgb(207 225 255 / 78%) 100%);
}
body.a #background,
body.a .ThemeColors {
transition: filter 1s;
filter: hue-rotate(10deg);
}
body.b #background,
body.b .ThemeColors {
transition: filter 1s;
filter: hue-rotate(-15deg);
}
body.c #background,
body.c .ThemeColors {
transition: filter 1s;
filter: hue-rotate(-40deg);
}
#body{
margin-top: 4rem;
overflow: hidden;
}
#DrawDiv{
background-color: #ffffff70;
min-height: 30rem;
max-width: 45rem;
margin: 1rem auto auto;
border-radius: 1.5rem;
overflow: hidden;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: stretch;
}
#inputDraw{
resize: none;
background-color: #ffffff00;
flex: 1;
margin-left: 1rem;
height: 2rem;
font-size: 1rem;
border: none;
outline:none;
line-height: 2rem;
}
#DrawInputDiv{
background-color: #ffffff;
margin-left: 1rem;
margin-right: 1rem;
margin-top: 1rem;
border-radius: 0.5rem;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: stretch;
}
#startDraw{
background-color: #0e00ff36;
border-radius: 0 0.5rem 0.5rem 0;
display: flex;
padding: 0.5rem;
align-items: center;
cursor: pointer;
font-size: 1rem;
}
#startDraw:hover{
background-color: rgba(14, 0, 255, 0.56);
}
#DrawInputDiv{
border: 1px solid rgba(0, 0, 0, 0.21);
}
#DrawInputDiv:has(#inputDraw:focus-visible){
border: 1px solid #0e00ff36;
}
#imgs{
margin-top: 1rem;
background-color: #c2b4ff29;
flex: 1;
border: 0.2rem solid #ffffff70;
border-top: none;
border-radius: 0 0 1.5rem 1.5rem;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: stretch;
justify-content: space-around;
align-content: space-around;
color: #ff8300;
font-size: 1rem;
font-weight: bolder;
}
#imgs>img{
width: 49%;
margin: 0.5%;
transition: all 0.5s;
cursor: pointer;
}
#imgs>img:hover{
transform:translate(-0.5%, -0.5%);
}
@media screen and (max-width:500px) {
:root {
font-size: 3.5vmin;
}
#imgs>img{
width: 99%;
}
}
@media screen and (orientation:portrait) and (max-device-width:800px) and (max-device-height:1000px) {
:root {
font-size: 3.5vmin;
}
#imgs>img{
width: 99%;
}
}

View file

@ -2,6 +2,7 @@
<meta charset="UTF-8">
<title id="docTitle">Draw</title>
<link rel="stylesheet" href="./css/DrawImg.css">
<script type="text/javascript" src="./js/generateImages.js"></script>
</head>
<body>
<div id="DrawDiv">
@ -13,8 +14,13 @@
</div>
</div>
<script type="module">
import generateImages from "./js/module/generateImages.js";
<script>
async function getMagicUrl() {
let v = localStorage.GoGoUrl;
if(v && v.startsWith("http")) return v;
return "https://mybing2.xn--xyza.top/";
}
const magicUrl = getMagicUrl();
const inputDraw = document.getElementById('inputDraw');
const imgsDiv = document.getElementById('imgs');
async function draw() {

View file

@ -6,7 +6,7 @@ const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
* @param countF 回调函数获取当前是第几次请求
* @return [...{img:url,mImg:url}...] img:图片url mIng:缩略图url
* */
export default async function generateImages(text,requestId,countF){
async function generateImages(text,requestId,countF){
let theUrls = new URLSearchParams();
theUrls.append('re', '1');
theUrls.append('showselective', '1');
@ -15,7 +15,7 @@ export default async function generateImages(text,requestId,countF){
theUrls.append('SFX', '2');
theUrls.append('q', text);
theUrls.append('iframeid', requestId);
let theUrl = `${window.location.origin}/images/create?${theUrls.toString()}`;
let theUrl = magicUrl+`images/create?${theUrls.toString()}`;
let response = await fetch(theUrl);
let html = (await response.text());
let cookieID = response.headers.get('cookieID');
@ -39,7 +39,7 @@ export default async function generateImages(text,requestId,countF){
}
let ur = urr[1];
ur = ur.replaceAll('&amp;','&');
let imgPageHtmlUrl = `${window.location.origin}/${ur}`;
let imgPageHtmlUrl = magicUrl + `${ur}`;
for(let count = 1;count<=20;count++){
if((!!countF)&&(typeof countF =='function')){
countF(count);

View file

@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>/en/_posts/</loc>
<lastmod>2023-05-08T21:16:14+08:00</lastmod>
<lastmod>2023-05-09T22:48:54+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
@ -16,7 +16,7 @@
/>
</url><url>
<loc>/en/offlinecache/</loc>
<lastmod>2023-04-19T22:58:18+08:00</lastmod>
<lastmod>2023-05-09T22:48:54+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
@ -58,7 +58,7 @@
/>
</url><url>
<loc>/en/</loc>
<lastmod>2023-05-08T21:16:14+08:00</lastmod>
<lastmod>2023-05-09T22:48:54+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"