Google音译建议CSS不正确 [英] Google Transliteration Suggestion CSS not proper

查看:138
本文介绍了Google音译建议CSS不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照步骤解决了无法通过HTTPS提供音译API的问题:

I followed the steps to solve the problem of Transliteration API not being served over HTTPS: Javascript google transliterate API not served over https

我提取了Google JSAPI& Transliteration.I.js到我自己的文件中,并添加了https.

I extracted Google JSAPI & Transliteration.I.js to my own file and added https.

但是在那之后,建议会在页面底部的div中弹出,而不像通常的下拉菜单那样.

But After that, the suggestions pop up in a div at the bottom of the page and not like the usual dropdown.

不胜感激.

推荐答案

这是一个逐步的过程:

首先,有一个指向API的链接:

First, there's a link to API:

<script type="text/javascript" src="https://www.google.com/jsapi">

第二,访问上方的API链接,并按照以下内容搜索内容:

Second, Visit the API link above and search the contents as given below:

google.loader.ServiceBase = 'https://www.google.com/uds';

您需要替换google.loader.ServiceBase = 'yourfile.js';

注意:yourfile.js是您创建的脚本.

note: yourfile.js is a script created by you.

要做到这一点-您需要创建两个单独的JavaScript文件.为什么?因为google.loader.ServiceBase位于google.com/jsapi

And to do that - you need to create two separate JavaScript files. Why? because the google.loader.ServiceBase is inside google.com/jsapi

步骤1:创建两个JavaScript文件-假设main.jsextra.js

step 1: Create two JavaScript files - lets say main.js and extra.js

步骤2:将https://www.google.com/jsapi的内容保存到main.js

step 2: save the contents of https://www.google.com/jsapi to main.js

步骤3:将https://www.google.com/uds/api/elements/1.0/7ded0ef8ee68924d96a6f6b19df266a8/transliteration.I.js的内容保存到extra.js

step 3: save the contents of https://www.google.com/uds/api/elements/1.0/7ded0ef8ee68924d96a6f6b19df266a8/transliteration.I.js to extra.js

步骤4:在extra.js中-找到qi="http://www.google.com"并替换为qi="https://www.google.com"-记住将http更改为https并保存.

step 4: In extra.js - find qi="http://www.google.com" and replace with qi="https://www.google.com" - remember http is changed to https and save it.

第5步:现在回到main.js-您必须找到google.loader.ServiceBase = 'https://www.google.com/uds';并替换为google.loader.ServiceBase = 'extra.js';并保存.

step 5: Now back to main.js - you have to find the google.loader.ServiceBase = 'https://www.google.com/uds'; and replace with google.loader.ServiceBase = 'extra.js'; and save it.

步骤6:调用index.html中的两个文件.

step 6: Call both the files in your index.html.

<script type="text/javascript" src="main.js">
<script type="text/javascript" src="extra.js">

第7步:从该链接复制CSS.将其添加到文件transliteration.css中.将以下行添加到index.html

step 7: Copy CSS from this link & add it to a file transliteration.css. Add the following line to index.html

<link type="text/css" href="assets/google/js/transliteration.css" rel="stylesheet"/>

这应该为您提供显示音译弹出窗口所需的正确CSS.

This should get you the correct CSS required for showing the transliteration popup.

这篇关于Google音译建议CSS不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆