Coder Social home page Coder Social logo

Comments (4)

hifocus avatar hifocus commented on May 20, 2024

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.

littlegolden avatar littlegolden commented on May 20, 2024

才发现只有测试版才支持多语言。。。对了,大佬加上下面的代码,让 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.

hifocus avatar hifocus commented on May 20, 2024

@littlegolden 这是一个好建议,将在下一个版本补充;但是我记得不需要这么繁复的 js...你可以去看看 function.js 里面应该是有的。

同时,目前 0.20 版本为 pre-release - 预先发布,而非测试版。0.20 版本仅有一个小错误,将会在下一个版本修复。

目前 0.20 还是预发布版本的原因为英文文档还没有同步新功能。

from merger.

hifocus avatar hifocus commented on May 20, 2024

才发现只有测试版才支持多语言。。。对了,大佬加上下面的代码,让 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.