mirror of
https://github.com/wahyd4/Libr-mobile.git
synced 2026-08-09 04:45:57 +10:00
remove umeng siocal share plugin files
This commit is contained in:
@@ -1,361 +0,0 @@
|
||||
.c {
|
||||
clear: both;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
@keyframes showCover {
|
||||
from {
|
||||
background: RGBA(50, 50, 50, 0);
|
||||
}
|
||||
to {
|
||||
background: RGBA(50, 50, 50, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes showCover {
|
||||
from {
|
||||
background: RGBA(50, 50, 50, 0);
|
||||
}
|
||||
to {
|
||||
background: RGBA(50, 50, 50, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes closeCover {
|
||||
from {
|
||||
background: RGBA(50, 50, 50, 0.1);
|
||||
}
|
||||
to {
|
||||
background: RGBA(50, 50, 50, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes closeCover {
|
||||
from {
|
||||
background: RGBA(50, 50, 50, 0.1);
|
||||
}
|
||||
to {
|
||||
background: RGBA(50, 50, 50, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.cover {
|
||||
background: RGBA(50, 50, 50, 0.1);
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
animation: showCover .5s steps(8, end) 1;
|
||||
-webkit-animation: showCover .5s steps(8, end) 1;
|
||||
}
|
||||
|
||||
.cover.remove {
|
||||
opacity: 0;
|
||||
animation: closeCover .5s steps(8, end) 1;
|
||||
-webkit-animation: closeCover .5s steps(8, end) 1;
|
||||
}
|
||||
|
||||
@keyframes showShareList {
|
||||
from {
|
||||
bottom: -50%;
|
||||
}
|
||||
to {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes showShareList {
|
||||
from {
|
||||
bottom: -50%;
|
||||
}
|
||||
to {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes closeShareList {
|
||||
from {
|
||||
bottom: 0%;
|
||||
}
|
||||
to {
|
||||
bottom: -50%;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes closeShareList {
|
||||
from {
|
||||
bottom: 0%;
|
||||
}
|
||||
to {
|
||||
bottom: -50%;
|
||||
}
|
||||
}
|
||||
|
||||
ul.shareList {
|
||||
display: block;
|
||||
bottom: 0;
|
||||
left: 0px;
|
||||
position: fixed;
|
||||
overflow: auto;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
z-index: 110;
|
||||
background: #EEEEEE;
|
||||
animation: showShareList .5s steps(8, end) 1;
|
||||
-webkit-animation: showShareList .5s steps(8, end) 1;
|
||||
}
|
||||
|
||||
ul.shareList.remove {
|
||||
bottom: -50%;
|
||||
animation: closeShareList .5s steps(8, end) 1;
|
||||
-webkit-animation: closeShareList .5s steps(8, end) 1;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item {
|
||||
border: 1px solid #EFEFEF;
|
||||
border-width: 0px 1px 1px 0px;
|
||||
background: #FFF;
|
||||
list-style: none;
|
||||
display: block;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
float: left;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item span {
|
||||
position: absolute;
|
||||
bottom: 5%;
|
||||
font-size: 0.75em;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #888;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_sina {
|
||||
background: url('../../img/social.umeng/umeng_socialize_sina_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_tencent {
|
||||
background: url('../../img/social.umeng/umeng_socialize_tx_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_wx_session {
|
||||
background: url('../../img/social.umeng/umeng_socialize_wechat.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_wx_timeline {
|
||||
background: url('../../img/social.umeng/umeng_socialize_wxcircle.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_qzone {
|
||||
background: url('../../img/social.umeng/umeng_socialize_qzone_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_renren {
|
||||
background: url('../../img/social.umeng/umeng_socialize_renren_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_qq {
|
||||
background: url('../../img/social.umeng/umeng_socialize_qq_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_facebook {
|
||||
background: url('../../img/social.umeng/umeng_socialize_facebook.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_twitter {
|
||||
background: url('../../img/social.umeng/umeng_socialize_twitter.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_sms {
|
||||
background: url('../../img/social.umeng/umeng_socialize_sms.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_email {
|
||||
background: url('../../img/social.umeng/umeng_socialize_gmail.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item_douban {
|
||||
background: url('../../img/social.umeng/umeng_socialize_douban_on.png') no-repeat #FFF center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
ul.shareList li.shareList_item:focus {
|
||||
background-color: #E3EDFC;
|
||||
}
|
||||
|
||||
.sharePage {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 2px 3px 5px rgba(0, 0, 0, 1);
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
.sharePage .sharePageTitle {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
background: #EFF2F8;
|
||||
border-bottom: 1px solid #DDD;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sharePage .sharePageTitle span {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.icon-back, .icon-submit {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.icon-back {
|
||||
background: url('../../img/social.umeng/back.png') no-repeat center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
.icon-submit {
|
||||
background: url('../../img/social.umeng/send.png') no-repeat center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
.icon-submit.disabled {
|
||||
background: url('../../img/social.umeng/send_disable.png') no-repeat center center;
|
||||
background-size: 60%;
|
||||
}
|
||||
|
||||
.icon-back:focus, .icon-submit:focus {
|
||||
background-color: #E4EFFB;
|
||||
}
|
||||
|
||||
/*.sharePage .sharePageTitle .sharePageBack {*/
|
||||
/*position: absolute;*/
|
||||
/*left: 0px;*/
|
||||
/*top: 0px;*/
|
||||
/*}*/
|
||||
|
||||
/*.sharePage .sharePageTitle .sharePageSubmit {*/
|
||||
/*position: absolute;*/
|
||||
/*right: 0px;*/
|
||||
/*top: 0px;*/
|
||||
/*}*/
|
||||
|
||||
/*.sharePage .sharePageContent {*/
|
||||
/*position: fixed;*/
|
||||
/*display: block;*/
|
||||
/*top: 50px;*/
|
||||
/*bottom: 110px;*/
|
||||
/*left: 10px;*/
|
||||
/*right: 10px;*/
|
||||
/*background: #FFF;*/
|
||||
/*border: none;*/
|
||||
/*position: fixed;*/
|
||||
/*font-size: 1em;*/
|
||||
/*}*/
|
||||
|
||||
/*.sharePage .sharePageBottom {*/
|
||||
/*position: fixed;*/
|
||||
/*bottom: 0;*/
|
||||
/*width: 100%;*/
|
||||
/*left: 0;*/
|
||||
/*height: 40px;*/
|
||||
/*line-height: 40px;*/
|
||||
/*background: #EFF2F8;*/
|
||||
/*border-top: 1px solid #DDD;*/
|
||||
/*}*/
|
||||
|
||||
/*.sharePage .sharePageBottom .shareBottomBtn {*/
|
||||
/*width: 30px;*/
|
||||
/*height: 30px;*/
|
||||
/*background: #FF0;*/
|
||||
/*border-radius: 5px;*/
|
||||
/*position: relative;*/
|
||||
/*display: block;*/
|
||||
/*float: left;*/
|
||||
/*margin: 5px 10px;*/
|
||||
/*}*/
|
||||
|
||||
.shareGeo {
|
||||
position: absolute;
|
||||
top: -30px;
|
||||
left: 10px;
|
||||
font-size: 1em;
|
||||
height: 20px;
|
||||
border: 1px solid #CCC;
|
||||
border-radius: 15px;
|
||||
line-height: 20px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
width: 150px;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shareImg {
|
||||
position: absolute;
|
||||
bottom: 50px;
|
||||
right: 10px;
|
||||
max-height: 70px;
|
||||
max-width: 70px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.umTip {
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: none;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.umTip span {
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
font-size: 0.75em;
|
||||
background: RGBA(0, 0, 0, 0.8);
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
video {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ libr = angular.module 'libr.constant', []
|
||||
|
||||
Constant = {}
|
||||
#Constant.baseUrl = "http://libr.herokuapp.com/api/v1"
|
||||
Constant.baseUrl = "http://10.117.100.31:3000/api/v1"
|
||||
Constant.baseUrl = "http://10.17.2.24:3000/api/v1"
|
||||
|
||||
|
||||
libr.constant 'Constant', Constant
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ gulp.task('copy', function () {
|
||||
.pipe(gulp.dest('./www'));
|
||||
gulp.src(paths.cordova.assets)
|
||||
.pipe(gulp.dest('./www/assets'));
|
||||
})
|
||||
});
|
||||
|
||||
gulp.task('default', ['bower', 'scripts', 'css', 'watch', 'fonts', 'server', 'copy']);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
-6
File diff suppressed because one or more lines are too long
@@ -1,578 +0,0 @@
|
||||
(function ($) {
|
||||
$.fn.umshare = function (options) {
|
||||
$.fn.umshare.initDevice();
|
||||
if (!options.data.platform) {
|
||||
options.data.platform = {};
|
||||
}
|
||||
for (i in $.fn.umshare.defaults.data.platform) {
|
||||
if (!options.data.platform[i]) {
|
||||
options.data.platform[i] = {};
|
||||
}
|
||||
options.data.platform[i].content = $.extend(true, {}, options.data.content, options.data.platform[i].content || {});
|
||||
}
|
||||
var opts = $.extend(true, {}, $.fn.umshare.defaults, options);
|
||||
var _this = $(this);
|
||||
var init = function () {
|
||||
$.fn.umshare.getUid(opts.topic, function () {
|
||||
_this.click(function () {
|
||||
shareList();
|
||||
});
|
||||
});
|
||||
}
|
||||
var shareList = function () {
|
||||
var cr = opts.list.vertical;
|
||||
if ($(window).width() > $(window).height()) {
|
||||
cr = opts.list.horizontal;
|
||||
}
|
||||
var itemSideLength = $(window).width() / cr.col;
|
||||
$("body ul.shareList").remove();
|
||||
$("body div.cover").remove();
|
||||
var list = $('<ul class="shareList"></ul>');
|
||||
for (i in opts.data.platform) {
|
||||
list.append('<li class="shareList_item shareList_item_' + i + '" val="' + i + '"><span>' + opts.data.platform[i].name + '</span></li>');
|
||||
}
|
||||
list.append("<div class=c></div>");
|
||||
|
||||
list.css({
|
||||
height: itemSideLength * cr.row
|
||||
});
|
||||
list.find("li").css({
|
||||
width: itemSideLength - 1,
|
||||
height: itemSideLength - 1
|
||||
})
|
||||
//show
|
||||
var showList = function () {
|
||||
$("body").append("<div class='cover'></div>");
|
||||
$('body').append(list);
|
||||
}
|
||||
//close
|
||||
var closeList = function (callback) {
|
||||
list.addClass('remove');
|
||||
$(".cover").addClass('remove');
|
||||
setTimeout(function () {
|
||||
list.remove();
|
||||
$(".cover").remove();
|
||||
}, 500);
|
||||
}
|
||||
showList();
|
||||
$(".cover").click(function () {
|
||||
closeList();
|
||||
});
|
||||
list.find("li.shareList_item").click(function () {
|
||||
closeList();
|
||||
var plat = $(this).attr('val');
|
||||
var opt = {};
|
||||
opt.data = opts.data.platform[plat];
|
||||
$.fn.umshare.share(plat, opt);
|
||||
});
|
||||
};
|
||||
init();
|
||||
|
||||
};
|
||||
$.fn.umshare.tip = function (text) {
|
||||
var tip = $("<div class='umTip'><span>" + text + "</span><div>");
|
||||
tip.appendTo($("body")).fadeIn(300).delay(1000).fadeOut(300, function () {
|
||||
tip.remove();
|
||||
});
|
||||
};
|
||||
$.fn.umshare.getUid = function (opt, callback) {
|
||||
$.fn.umshare.initDevice();
|
||||
if (window.localStorage.getItem('uid')) {
|
||||
$.fn.umshare.constant.baseParams.ek = window.localStorage.getItem('ek');
|
||||
$.fn.umshare.constant.baseParams.uid = window.localStorage.getItem('uid');
|
||||
callback();
|
||||
} else {
|
||||
var url = $.fn.umshare.constant.baseUrl + '/bar/get/' + $.fn.umshare.constant.baseParams.ak + '/';
|
||||
var params = $.extend(true, {}, $.fn.umshare.constant.baseParams, opt || {});
|
||||
$.get(url, params, function (d) {
|
||||
window.localStorage.setItem('ek', d.data.ek);
|
||||
window.localStorage.setItem('uid', d.data.uid);
|
||||
$.fn.umshare.constant.baseParams.ek = d.data.ek;
|
||||
$.fn.umshare.constant.baseParams.uid = d.data.uid;
|
||||
callback(d.data.uid);
|
||||
}, 'json');
|
||||
}
|
||||
};
|
||||
$.fn.umshare.login = function (plat, callback) {
|
||||
var opt = {
|
||||
'dc': 'default',
|
||||
'name': 'default',
|
||||
'ni': 1
|
||||
}
|
||||
$.fn.umshare.getUid(opt, function () {
|
||||
$.fn.umshare.initDevice();
|
||||
var href = '';
|
||||
var url = $.fn.umshare.constant.baseUrl + '/share/auth/' + $.fn.umshare.constant.baseParams.ak + '/' + $.fn.umshare.constant.baseParams.ek + '/?';
|
||||
var params = {
|
||||
'via': plat,
|
||||
'opid': 10
|
||||
};
|
||||
params = $.extend(true, {}, $.fn.umshare.constant.baseParams, params);
|
||||
for (i in params) {
|
||||
url += i + '=' + params[i] + '&';
|
||||
}
|
||||
var loginWindow = window.open(url, '_blank', 'location=no');
|
||||
loginWindow.addEventListener('loadstart', function (event) {
|
||||
href = ('start: ' + event.url);
|
||||
if (href.indexOf("access_secret") > -1) {
|
||||
var params = href.split("?")[1].split("&");
|
||||
var pm = {};
|
||||
for (i in params) {
|
||||
var kv = params[i].split("=");
|
||||
pm[kv[0]] = kv[1];
|
||||
}
|
||||
loginWindow.close();
|
||||
$.fn.umshare.saveToken(plat, pm.access_secret, pm.uid);
|
||||
callback({'token': pm.access_secret, 'uid': pm.uid});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$.fn.umshare.saveToken = function (plat, token, uid) {
|
||||
window.localStorage.setItem(plat, token + ',' + uid);
|
||||
return true;
|
||||
}
|
||||
$.fn.umshare.getToken = function (plat) {
|
||||
var token = window.localStorage.getItem(plat);
|
||||
if (token) {
|
||||
token = token.split(',');
|
||||
var user = {
|
||||
'token': token[0],
|
||||
'uid': token[1]
|
||||
};
|
||||
return user;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$.fn.umshare.checkToken = function (plat, callback) {
|
||||
var token = window.localStorage.getItem(plat);
|
||||
if (token) {
|
||||
token = token.split(',');
|
||||
var user = {
|
||||
'token': token[0],
|
||||
'uid': token[1]
|
||||
};
|
||||
callback(user);
|
||||
} else {
|
||||
$.fn.umshare.login(plat, callback);
|
||||
}
|
||||
}
|
||||
$.fn.umshare.delToken = function (plat) {
|
||||
return window.localStorage.removeItem(plat);
|
||||
}
|
||||
$.fn.umshare.initDevice = function () {
|
||||
try {
|
||||
if (!device) {
|
||||
$.fn.umshare.tip("系统错误:缺少org.apache.cordova.device");
|
||||
}
|
||||
if (!navigator.network) {
|
||||
$.fn.umshare.tip("系统错误:缺少org.apache.cordova.network-information");
|
||||
}
|
||||
$.fn.umshare.constant.baseParams = $.extend(true, {}, $.fn.umshare.constant.baseParams, {
|
||||
'imei': device.uuid,
|
||||
'sdkv': '5.0',
|
||||
'pcv': '2.0',
|
||||
'de': device.model,
|
||||
'os': device.platform,
|
||||
'ak': window.umappkey ? window.umappkey : '528dc5aa56240bb52f02343c',
|
||||
'ek': '000',
|
||||
'en': navigator.network.connection.type,
|
||||
'phonegap': '1',
|
||||
'tp': 0
|
||||
});
|
||||
} catch (e) {
|
||||
$.fn.umshare.tip("系统错误:缺少org.apache.cordova.device或org.apache.cordova.network-information");
|
||||
$.fn.umshare.constant.baseParams = $.extend(true, {}, $.fn.umshare.constant.baseParams, {
|
||||
'imei': '-1',
|
||||
'sdkv': '5.0',
|
||||
'pcv': '2.0',
|
||||
'de': '-1',
|
||||
'os': '-1',
|
||||
'ak': window.umappkey ? window.umappkey : '528dc5aa56240bb52f02343c',
|
||||
'ek': '000',
|
||||
'en': 'null',
|
||||
'phonegap': '1',
|
||||
'tp': 0
|
||||
});
|
||||
}
|
||||
}
|
||||
$.fn.umshare.share = function (plat, c) {
|
||||
$.fn.umshare.initDevice();
|
||||
if (!c.name) {
|
||||
c.name = $.fn.umshare.defaults.data.platform[plat].name;
|
||||
}
|
||||
var sharePanel = function (plat, c) {
|
||||
var panel = $('<div class="bar bar-header bar-positive">\
|
||||
<button class="button icon sharePageBack ion-arrow-left-c"></button>\
|
||||
<h1 class="title">分享到' + c.name + '</h1>\
|
||||
<button class="button sharePageSubmit icon ion-checkmark-round"></button>\
|
||||
</div><div class="padding has-header">\
|
||||
<div class="list">\
|
||||
<textarea class="sharePageContent">' + c.data.content.text + '</textarea>\
|
||||
</div></div>\
|
||||
<div class="sharePageBottom">\
|
||||
<span class="shareGeo"></span>\
|
||||
<img id="shareImage" class="shareImg" src="' + (c.data.content.img ? c.data.content.img : c.data.content.furl) + '"/>\
|
||||
</div>\
|
||||
</div>');
|
||||
if (panel.find("#shareImage").attr("src") != "") {
|
||||
panel.find("#shareImage").show();
|
||||
}
|
||||
var getGeo = function () {
|
||||
$('.shareGeo').html("获取位置(GPS)");
|
||||
var getGeoSuccess = function (position) {
|
||||
$.fn.umshare.checkToken(plat, function (user) {
|
||||
$.fn.umshare.constant.lc = '(' + position.coords.longitude + ',' + position.coords.latitude + ')';
|
||||
var url = $.fn.umshare.constant.baseUrl + '/share/geo/' + $.fn.umshare.constant.baseParams.ak + '/' + $.fn.umshare.constant.baseParams.ek;
|
||||
var params = {
|
||||
'lc': location,
|
||||
'via': plat,
|
||||
'usid': user.uid
|
||||
};
|
||||
$.get(url, params, function (d) {
|
||||
if (d.st == '200') {
|
||||
$('.shareGeo').html(d.data.address);
|
||||
} else {
|
||||
$('.shareGeo').html('未知地点');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
var getGeoError = function (error) {
|
||||
$('.shareGeo').html("获取位置(Internet)");
|
||||
navigator.geolocation.getCurrentPosition(getGeoSuccess, function () {
|
||||
$('.shareGeo').html('未知地点');
|
||||
}, { maximumAge: 3000, timeout: 30000, enableHighAccuracy: false });
|
||||
}
|
||||
navigator.geolocation.getCurrentPosition(getGeoSuccess, getGeoError, { maximumAge: 3000, timeout: 30000, enableHighAccuracy: true });
|
||||
}
|
||||
var showPanel = function () {
|
||||
panel.appendTo($("body"));
|
||||
getGeo();
|
||||
}
|
||||
var closePanel = function (callback) {
|
||||
panel.addClass("remove");
|
||||
setTimeout(function () {
|
||||
panel.remove();
|
||||
}, 500);
|
||||
}
|
||||
showPanel();
|
||||
$(".sharePageBack").click(function () {
|
||||
closePanel();
|
||||
});
|
||||
/*
|
||||
*拍照功能
|
||||
*/
|
||||
$(".shareCamera").click(function () {
|
||||
navigator.camera.getPicture(function (imageData) {
|
||||
var image = $('#shareImage');
|
||||
image.attr('src', imageData).show();
|
||||
}, function (message) {
|
||||
$.fn.umshare.tip(message);
|
||||
}, { quality: 75,
|
||||
destinationType: Camera.DestinationType.FILE_URI,
|
||||
sourceType: Camera.PictureSourceType.CAMERA,
|
||||
allowEdit: true,
|
||||
mediaType: Camera.MediaType.PICTURE,
|
||||
encodingType: Camera.EncodingType.JPEG,
|
||||
saveToPhotoAlbum: true
|
||||
});
|
||||
});
|
||||
/* */
|
||||
/*
|
||||
*读取本地照片
|
||||
*/
|
||||
$(".sharePic").click(function () {
|
||||
navigator.camera.getPicture(function (imageData) {
|
||||
var image = $('#shareImage');
|
||||
image.attr('src', imageData).show();
|
||||
}, function (message) {
|
||||
$.fn.umshare.tip(message);
|
||||
}, { quality: 75,
|
||||
destinationType: Camera.DestinationType.FILE_URI,
|
||||
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
|
||||
allowEdit: true,
|
||||
mediaType: Camera.MediaType.PICTURE,
|
||||
encodingType: Camera.EncodingType.JPEG,
|
||||
saveToPhotoAlbum: true
|
||||
});
|
||||
});
|
||||
/* */
|
||||
$("#shareImage").click(function () {
|
||||
$(this).attr("src", "").hide();
|
||||
});
|
||||
$(".sharePageSubmit").click(function () {
|
||||
closePanel();
|
||||
var content = $(".sharePageSubmit").parent().parent().find(".sharePageContent").val();
|
||||
var imageURI = $("#shareImage").attr("src");
|
||||
c.data.content.text = content;
|
||||
c.data.content.img = imageURI;
|
||||
$.fn.umshare.shareSubmit(plat, c);
|
||||
});
|
||||
}
|
||||
var shareToPlat = {
|
||||
'sina': function () {
|
||||
sharePanel(plat, c);
|
||||
},
|
||||
'douban': function () {
|
||||
sharePanel(plat, c);
|
||||
},
|
||||
'renren': function () {
|
||||
sharePanel(plat, c);
|
||||
},
|
||||
'qzone': function () {
|
||||
sharePanel(plat, c);
|
||||
}
|
||||
};
|
||||
if (shareToPlat[plat]) {
|
||||
var share = shareToPlat[plat];
|
||||
share();
|
||||
} else {
|
||||
$.fn.umshare.tip("not supported!");
|
||||
}
|
||||
}
|
||||
$.fn.umshare.CheckImg = function (imgurl) {
|
||||
var ImgObj = new Image();
|
||||
ImgObj.src = imgurl;
|
||||
if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
|
||||
return ImgObj;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$.fn.umshare.shareSubmit = function (plat, c) {
|
||||
$.fn.umshare.getUid(c.topic, function () {
|
||||
$.fn.umshare.initDevice();
|
||||
var content = c.data.content.text;
|
||||
var imageURI = $.fn.umshare.CheckImg(c.data.content.img ? c.data.content.img : c.data.content.furl);
|
||||
if (!content) {
|
||||
$.fn.umshare.tip('参数不全!');
|
||||
return false;
|
||||
}
|
||||
$.fn.umshare.checkToken(plat, function (token) {
|
||||
var uid = token.uid;
|
||||
var token = token.token;
|
||||
var url = $.fn.umshare.constant.baseUrl + '/share/multi_add/' + $.fn.umshare.constant.baseParams.ak + '/' + $.fn.umshare.constant.baseParams.ek + '/';
|
||||
var params = {
|
||||
'ct': content
|
||||
};
|
||||
if ($.fn.umshare.constant.location) {
|
||||
params.lc = $.fn.umshare.constant.location;
|
||||
}
|
||||
if (c.data.content.furl) {
|
||||
params.furl = c.data.content.furl;
|
||||
}
|
||||
if (c.data.content.furl == imageURI.src) {
|
||||
imageURI = false;
|
||||
}
|
||||
params.sns = {};
|
||||
params.sns[plat] = uid;
|
||||
params.sns = JSON.stringify(params.sns);
|
||||
params = $.extend(true, {}, $.fn.umshare.constant.baseParams, params);
|
||||
$.fn.umshare.tip('发送中...');
|
||||
if (imageURI) {
|
||||
imageURI = imageURI.src;
|
||||
var options = new FileUploadOptions();
|
||||
options.fileKey = "pic";
|
||||
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
|
||||
options.mimeType = "image/jpeg";
|
||||
options.params = params;
|
||||
var ft = new FileTransfer();
|
||||
ft.upload(imageURI, url, function (r) {
|
||||
d = eval('(' + r.response + ')');
|
||||
if (d.st == '200') {
|
||||
$.fn.umshare.tip("发送成功!");
|
||||
c.callback();
|
||||
} else {
|
||||
$.fn.umshare.tip(d.msg);
|
||||
}
|
||||
}, function (error) {
|
||||
$.fn.umshare.tip("发送失败!请稍候再试");
|
||||
}, options);
|
||||
|
||||
} else {
|
||||
$.post(url, params, function (d) {
|
||||
if (d.st == '200') {
|
||||
$.fn.umshare.tip("发送成功!");
|
||||
c.callback();
|
||||
} else {
|
||||
$.fn.umshare.tip(d.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$.fn.umshare.shake = function (opt, callback) {
|
||||
try {
|
||||
var defOpt = {
|
||||
freq: 1000,
|
||||
sens: 200
|
||||
};
|
||||
opts = $.extend(true, defOpt, opt || {});
|
||||
function startWatch() {
|
||||
var options = { frequency: opts.freq };
|
||||
|
||||
watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
|
||||
}
|
||||
|
||||
function stopWatch() {
|
||||
if (watchID) {
|
||||
navigator.accelerometer.clearWatch(watchID);
|
||||
watchID = null;
|
||||
}
|
||||
}
|
||||
|
||||
function onSuccess(acceleration) {
|
||||
var a = parseInt(acceleration.x * acceleration.x + acceleration.y * acceleration.y + acceleration.z * acceleration.z);
|
||||
if (a > opts.sens) {
|
||||
stopWatch();
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function onError() {
|
||||
alert('onError!');
|
||||
}
|
||||
|
||||
startWatch();
|
||||
} catch (e) {
|
||||
$.fn.umshare.tip("系统错误:缺少org.apache.cordova.device-motion");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$.fn.umshare.screenshot = function (opt, callback) {
|
||||
var defOpt = {};
|
||||
opts = $.extend(true, defOpt, opt || {});
|
||||
var stored = function (dataUrl) {
|
||||
var url = "";
|
||||
|
||||
function dataUrlToBuffer(dataurl) {
|
||||
var datas = dataurl.split(',', 2);
|
||||
var data = atob(datas[1]);
|
||||
var arr = new Uint8Array(data.length);
|
||||
for (var i = 0, l = data.length; i < l; i++) {
|
||||
arr[i] = data.charCodeAt(i);
|
||||
}
|
||||
return arr.buffer;
|
||||
};
|
||||
|
||||
var buffer = dataUrlToBuffer(dataUrl);
|
||||
|
||||
|
||||
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
|
||||
function gotFS(fileSystem) {
|
||||
var fileName = (new Date()).valueOf();
|
||||
fileSystem.root.getDirectory("Camera", { create: true, exclusive: false },
|
||||
function (dirEntry) {
|
||||
dirEntry.getDirectory("umshare", { create: true, exclusive: false }, function (dE) {
|
||||
dE.getFile(fileName + ".png", { create: true, exclusive: false }, gotFileEntry, fail);
|
||||
}, function (err) {
|
||||
alert('文件夹读取失败,错误代码:' + error.code);
|
||||
});
|
||||
},
|
||||
function (err) {
|
||||
alert('文件夹读取失败,错误代码:' + error.code);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function gotFileEntry(fileEntry) {
|
||||
url = fileEntry.toURL();
|
||||
fileEntry.createWriter(gotFileWriter, fail);
|
||||
}
|
||||
|
||||
function gotFileWriter(writer) {
|
||||
writer.onwriteend = function (evt) {
|
||||
$.fn.umshare.tip("截图成功!保存在" + url);
|
||||
callback(url);
|
||||
};
|
||||
writer.write(buffer);
|
||||
}
|
||||
|
||||
function fail(error) {
|
||||
alert('文件保存失败,错误代码:' + error.code);
|
||||
}
|
||||
}
|
||||
if (opts.video) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = opts.video.videoWidth;
|
||||
canvas.height = opts.video.videoHeight;
|
||||
canvas.getContext('2d')
|
||||
.drawImage(opts.video, 0, 0, canvas.width, canvas.height);
|
||||
try {
|
||||
var dataUrl = canvas.toDataURL();
|
||||
stored(dataUrl);
|
||||
} catch (e) {
|
||||
alert('截图失败。权限问题');
|
||||
}
|
||||
} else {
|
||||
html2canvas(document.body, {
|
||||
allowTaint: true,
|
||||
taintTest: false,
|
||||
onrendered: function (canvas) {
|
||||
var dataUrl = canvas.toDataURL();
|
||||
stored(dataUrl);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.umshare.constant = {
|
||||
baseUrl: 'http://log.umsns.com'
|
||||
}
|
||||
$.fn.umshare.defaults = {
|
||||
'data': {
|
||||
'content': {
|
||||
'text': '友盟社会化组件,让移动应用快速整合社交分享功能!发给人人网'
|
||||
},
|
||||
'platform': {
|
||||
'sina': {
|
||||
'name': '新浪微博',
|
||||
'content': {
|
||||
'text': '友盟社会化组件,让移动应用快速整合社交分享功能!'
|
||||
}
|
||||
},
|
||||
'qzone': {
|
||||
'name': 'QQ空间',
|
||||
'content': {
|
||||
'text': '友盟社会化组件,让移动应用快速整合社交分享功能!发给QQ空间'
|
||||
}
|
||||
},
|
||||
'renren': {
|
||||
'name': '人人网',
|
||||
'content': {
|
||||
'text': '友盟社会化组件,让移动应用快速整合社交分享功能!发给人人网'
|
||||
}
|
||||
},
|
||||
'douban': {
|
||||
'name': '豆瓣',
|
||||
'content': {
|
||||
'text': '友盟社会化组件,让移动应用快速整合社交分享功能!发给豆瓣'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'topic': {
|
||||
'dc': 'default',
|
||||
'name': 'default',
|
||||
'ni': 1
|
||||
},
|
||||
'list': {
|
||||
'horizontal': {
|
||||
'col': 6,
|
||||
'row': 1
|
||||
},
|
||||
'vertical': {
|
||||
'col': 4,
|
||||
'row': 1
|
||||
}
|
||||
},
|
||||
'callback': function () {
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
Vendored
+1391
-19
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,9 @@
|
||||
</script>
|
||||
<script src="cordova.js"></script>
|
||||
<script type="text/javascript" src="assets/ionic/release/js/ionic.bundle.min.js"></script>
|
||||
<script src="js/umeng/jquery.js"></script>
|
||||
<script src="js/umeng/html2canvas.js"></script>
|
||||
<script src="js/umeng/social.umeng.js"></script>
|
||||
<script>
|
||||
document.addEventListener('deviceready', function () {
|
||||
ionic.Platform.detect();
|
||||
@@ -35,8 +38,8 @@
|
||||
|
||||
<script src="assets/angular-resource/angular-resource.min.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
|
||||
<script src="dist/js/all.min.js"></script>
|
||||
<!-- <script src="http://10.17.2.56:8080/target/target-script-min.js#anonymous"></script> -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</ion-nav-buttons>
|
||||
<ion-content has-header="true" padding="true" swipe-back>
|
||||
<div class="list card">
|
||||
<div class="item ">
|
||||
<div class="item item-body">
|
||||
<h2>{{book.name}}</h2>
|
||||
|
||||
<p><b>作者:</b>{{book.author}}</p>
|
||||
@@ -27,7 +27,7 @@
|
||||
<i class="icon ion-chatbox"></i>
|
||||
评论
|
||||
</a>
|
||||
<a class="tab-item" id="xyz" ng-click="goShare()">
|
||||
<a class="tab-item" id="xyz">
|
||||
<i class="icon ion-share"></i>
|
||||
分享
|
||||
</a>
|
||||
@@ -46,7 +46,20 @@
|
||||
|
||||
<p>{{comment.body}}</p>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
<script>
|
||||
var opt = {
|
||||
'data': {
|
||||
'content': {
|
||||
'text': '这里请填写要分享的文字内容',
|
||||
'img': 'img/default.jpg'
|
||||
}
|
||||
}
|
||||
};
|
||||
$("#xyz").umshare(opt);
|
||||
console.log('called share');
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</ion-nav-buttons>
|
||||
<ion-content has-header="true" padding="true" swipe-back>
|
||||
<div class="list card">
|
||||
<div class="item ">
|
||||
<div class="item item-body">
|
||||
<h2>{{book.name}}</h2>
|
||||
|
||||
<p><b>作者:</b>{{book.author}}</p>
|
||||
|
||||
Reference in New Issue
Block a user