V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  amiwrong123  ›  全部回复第 37 页 / 共 37 页
回复总数  726
1 ... 28  29  30  31  32  33  34  35  36  37  
@lhx2008
用得是 vs2017,找了找,在当前项目的什么设置里面,找到了“优化”,里面有什么内联函数拓展、启动内部函数什么的,但基本都是关着的。

@ipwx
const int& b = re();原来这种用法是不合法的吗?有点没懂啊,我知道如果返回局部变量的引用,这种情况是不合法的,虽然编译器只是报个 warning。


@stephen9357
原来是这样的啊。确实大概能看明白,比如函数体返回值那里有没有&(返回的是不是引用),会体现到汇编上去。虽然分配了两次空间,但可能就是编译器没优化好呗。
@caocong
```javascript
document.getElementById("source").onfocus = function(){
navigator.clipboard.readText().then(
clipText => {document.getElementById("source").value = clipText;})
setTimeout(()=> {
var a = document.getElementsByClassName('tlid-translation')[0];
var result = ''
//console.log(a.children.length);
for (var i = 0; i < a.children.length; i++){
//console.log(a.children[i].tagName);
if(a.children[i].tagName == 'SPAN' )
{//console.log(a.children[i].innerText);
result += a.children[i].innerText;
}else{
result += '\n';
}
}
navigator.clipboard.writeText(result)},2000);


};
```
原来大括号可以把语句框起来,这样就可以了。这样就解决了左边框有换行的情况。再次感谢啦。
@caocong
刚才我还在想怎么解决,对话,延时就好了。谢谢大佬。
但如果左边框有换行符,有边框 tlid-translation 里面的 children 不止一个,类似于:
<span title="" class="">遷移 Transition to the Audio </span>
<br>
<span title="" class="">遷移 Transition to the Audio </span>
这个好像不好弄,看语法好像没法写循环啊
@caocong
我在看一下,能不能把粘贴板的内容,替换为谷歌翻译的右边框的内容(翻译后的内容)。
@caocong
谢谢,好使了。但好使粘贴板里的内容如果是日文,好像有编码问题。我再百度百度吧。代码就是
```javascript
document.getElementById("source").onfocus = function(){
navigator.clipboard.readText().then(
clipText => {document.getElementById("source").value = clipText;})
}
```
还是说,我得在火狐的配置文件里面改什么吗? about:config 里面的 clipboard.autocopy 已经被我改成 true 了,但还是不好使。
1 ... 28  29  30  31  32  33  34  35  36  37  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3145 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 11:43 · PVG 19:43 · LAX 04:43 · JFK 07:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.