Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文章中分享部分有双引号的时候,js语法错误,导致无法分享 #52

Closed
CodFrm opened this issue Apr 15, 2018 · 1 comment
Closed

Comments

@CodFrm
Copy link

CodFrm commented Apr 15, 2018

问题描述
点击分享,报错

Uncaught SyntaxError: Unexpected identifier

kratos.js:241 项目托管:https://github.com/Vtrois/Kratos

1375:141 Uncaught ReferenceError: share is not defined
at HTMLAnchorElement.onclick (1375:141)

产生环境

  • 设备:(手机、平板等移动设备时填写此项)
  • 浏览器及版本:chrome 65.0.3325.181
  • 演示地址:无

文章中分享部分有双引号的时候,js语法错误,导致无法分享

我觉得可以处理一下双引号来解决这个问题

//var excerpt="这次来了解一下配置文件 composer.json 官方文档 版本符号表示意思(就是>=,~,^这些) 用命令创建一个 { "name": "codfrm/test", //包名 "description": "描述", //包描述 "license": "MIT",//开源协议,例如:MIT,Apache,BSD等 "authors":……";
	function share(obj){
		var qqShareURL="http://connect.qq.com/widget/shareqq/index.html?";
		var weiboShareURL="http://service.weibo.com/share/share.php?";
		var facebookShareURL="https://www.facebook.com/sharer/sharer.php?";
		var twitterShareURL="https://twitter.com/intent/tweet?";
		var googleplusShareURL="https://plus.google.com/share?";
		var host_url="https://blog.icodef.com/2018/04/16/1375";
		var title="【php composer 包依赖管理工具 - 自动加载 (二)】";
		var qqtitle="php composer 包依赖管理工具 - 自动加载 (二)";
		var excerpt="这次来了解一下配置文件 composer.json 官方文档 版本符号表示意思(就是>=,~,^这些) 用命令创建一个 { "name": "codfrm/test", //包名 "description": "描述", //包描述 "license": "MIT",//开源协议,例如:MIT,Apache,BSD等 "authors":……";
		var pic="";
		var _URL;
		if(obj=="qq"){
			_URL=qqShareURL+"url="+host_url+"&title="+qqtitle+"&pics="+pic+"&desc=&summary="+excerpt+"&site=vtrois";
		}else if(obj=="weibo"){
			_URL=weiboShareURL+"url="+host_url+"&title="+title+excerpt+"&pic="+pic;
		}else if(obj=="facebook"){
	 		_URL=facebookShareURL+"u="+host_url;
		}else if(obj=="twitter"){
	 		_URL=twitterShareURL+"text="+title+excerpt+"&url="+host_url;
		}else if(obj=="googleplus"){
	 		_URL=googleplusShareURL+"url="+host_url;
		}
		window.open(_URL);
	}
ghost pushed a commit that referenced this issue May 5, 2018
@ghost
Copy link

ghost commented May 5, 2018

问题修复了

@ghost ghost closed this as completed May 5, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant