Comments (4)
merger.justhx.com 本身没有做多语言识别,但是 https://docs.justhx.com/merger 是通过如下代码实现的:
var userLang = navigator.language || navigator.userLanguage;
if (userLang.includes("zh") || userLang.includes("cn")) {
window.location.replace("https://merger.justhx.com/cn/");
}
else {
window.location.replace("https://merger.justhx.com/");
}
在写这类型代码的时候,请注意永远有一个 else { } fallback,即就算判断条件一个都不符合,也要给访客一个目的地。
from merger.
才发现只有测试版才支持多语言。。。对了,大佬加上下面的代码,让 PayPal 的弹窗居中出现吧?正式版屏幕左上角出现就很怪异。我的Merger用的是默认的CDN,所以我在本地改没效果,您可以在这里看效果,第一行的卡片的右边就是贝宝。
function openbox() {
var paypal = "https://www.paypal.me/andrewsun74";
//window.screen.height获得屏幕的高,window.screen.width获得屏幕的宽
var iWidth = 500; //弹出窗口的宽度;
var iHeight = 640; //弹出窗口的高度;
var iTop = (window.screen.height-30-iHeight)/2; //获得窗口的垂直位置;
var iLeft = (window.screen.width-10-iWidth)/2; //获得窗口的水平位置;
selected = "yes";
window.open(
paypal,
"_blank",
'height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'
)
}
from merger.
@littlegolden 这是一个好建议,将在下一个版本补充;但是我记得不需要这么繁复的 js...你可以去看看 function.js 里面应该是有的。
同时,目前 0.20 版本为 pre-release - 预先发布,而非测试版。0.20 版本仅有一个小错误,将会在下一个版本修复。
目前 0.20 还是预发布版本的原因为英文文档还没有同步新功能。
from merger.
才发现只有测试版才支持多语言。。。对了,大佬加上下面的代码,让 PayPal 的弹窗居中出现吧?正式版屏幕左上角出现就很怪异。我的Merger用的是默认的CDN,所以我在本地改没效果,您可以在这里看效果,第一行的卡片的右边就是贝宝。
function openbox() { var paypal = "https://www.paypal.me/andrewsun74"; //window.screen.height获得屏幕的高,window.screen.width获得屏幕的宽 var iWidth = 500; //弹出窗口的宽度; var iHeight = 640; //弹出窗口的高度; var iTop = (window.screen.height-30-iHeight)/2; //获得窗口的垂直位置; var iLeft = (window.screen.width-10-iWidth)/2; //获得窗口的水平位置; selected = "yes"; window.open( paypal, "_blank", 'height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no' ) }
已于 084a93a 添加此特性;稍后会合并到主分支并发布新版本。
from merger.
Related Issues (15)
- Let us know if you are using merger! HOT 8
- jsDelivr SSL Issue in China HOT 1
- 请问怎么集成到 hexo 的主题中? HOT 1
- 可以做一个z-blog的插件吗? HOT 1
- 有办法三码合一吗 HOT 1
- 微信需要二次扫描才能识别 HOT 1
- Venmo QR code support? HOT 1
- 似乎没法获取gravatar的头像? HOT 2
- 增加捐赠列表? HOT 1
- 微信扫描二维码之后不会跳转到转账了 HOT 2
- 建议按UA自动跳转后,依然可以关闭二维码 HOT 3
- How to provide user services after payment has been received HOT 1
- jsDelivrCDN资源错误 HOT 3
- Please Update to Version 0.27.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merger.