Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zimocode committed Jul 2, 2019
2 parents 865de65 + 834266b commit f2c7190
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 2 deletions.
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1481,5 +1481,8 @@
},
"lottery_sd":{
"message":"Fucai 3D"
},
"pxmovie":{
"message":"Poxiao Movie recent update"
}
}
3 changes: 3 additions & 0 deletions _locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1450,5 +1450,8 @@
},
"lottery_sd":{
"message":"福彩3D"
},
"pxmovie":{
"message":"破晓电影最近更新"
}
}
8 changes: 8 additions & 0 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"log": [
{
"ver":"6.3.770.881",
"date":"2019.06.30",
"content":[
"new mini-apps: pxmovie",
"fix bugs"
]
},
{
"ver":"6.3.737.877",
"date":"2019.06.01",
Expand Down
90 changes: 90 additions & 0 deletions css/inject/pxmovie.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
smartup.su_apps#su_apps_pxmovie .su_pxmovie_box{
width: 360px;
padding: 8px;
}
smartup.su_apps#su_apps_pxmovie ul{
padding-bottom: 8px;
text-align: left;
width: 100%;
}
smartup.su_apps#su_apps_pxmovie li{
border: 1px solid rgba(204, 204, 255, 0.6);
border-radius: 2px;
padding: 0 8px;
margin: 1px 0;
width: 100%;
height: 32px;
line-height: 32px;
box-sizing: border-box;
/*font-weight: bold;*/
font-size: 14px;
color: rgba(0, 0, 0, 0.7);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
cursor: pointer;
transition:all .4s ease-in-out;
}
smartup.su_apps#su_apps_pxmovie li img{
width: 16px;
margin-right: 5px;
}
smartup.su_apps#su_apps_pxmovie li:hover{
box-shadow: 0px 1px 3px #ccc;
background: #d0d9ff;
line-height: 32px;
border-color: rgba(86,119,252,.5) !important;
}
smartup.su_apps#su_apps_pxmovie li:hover .su_tablist_button_liclose{
opacity: 1;
margin-top: -32px;
}
smartup.su_apps#su_apps_pxmovie li span{
display: block;
width: 100%;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
smartup.su_apps#su_apps_pxmovie li:hover .li_0{
transition:all .4s ease-out;
margin-top: -32px;
}
smartup.su_apps#su_apps_pxmovie .data{
}
smartup.su_apps#su_apps_pxmovie .name{
font-size: 14px;
font-weight: bold;
text-align: center;
margin-bottom: 4px;
}
smartup.su_apps#su_apps_pxmovie .info{
font-size: 12px;
text-align: left;
}
smartup.su_apps#su_apps_pxmovie .infolist{
display: inline-block;
width: 80px;
text-align: right;
font-weight: bold;
}
smartup.su_apps#su_apps_pxmovie .back{
margin-bottom: 10px;
position: absolute;
right: 8px;
top: 28px;
}
smartup.su_apps#su_apps_pxmovie .url{
margin-top: 5px;
min-height: 64px;
width: 354px;
border-radius: 8px;
border: 1px solid rgba(115, 143, 254, 0.7);
}
smartup.su_apps#su_apps_pxmovie .des{
text-indent: 24px;
border-top: 1px solid #00000057;
padding-top: 6px;
margin-top: 4px;
}
Binary file removed image/bg.jpg
Binary file not shown.
81 changes: 81 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,10 @@ var sub={

//mini apps

pxmovie:function(){
var _appname="pxmovie";
sub.insertTest(_appname);
},
lottery:function(){
var _appname="lottery";
sub.insertTest(_appname);
Expand Down Expand Up @@ -3835,6 +3839,9 @@ var sub={
break;
case"disableall":
for(var i=0;i<sub.cons.extmgm.ext_enabled.length;i++){
if(sub.cons.extmgm.ext_enabled[i].id==chrome.runtime.id){
continue;
}
chrome.management.setEnabled(sub.cons.extmgm.ext_enabled[i].id,false);
}
break;
Expand Down Expand Up @@ -3986,6 +3993,80 @@ var sub={
break;
}
}
},
pxmovie:{
getList:function(message,sender,sendResponse){
fetch("https://www.poxiao.com/")
.then(response=>response.blob())
.then(blob=>{
var reader = new FileReader();
reader.onload = function(e) {
var htmlData = reader.result;
htmlData=(new window.DOMParser()).parseFromString(htmlData,"text/html");
console.log(htmlData);
var data=[];
var _doms=htmlData.querySelectorAll(".container .content ul")[0].querySelectorAll("li");
for(var i=0;i<_doms.length;i++){
var _data=[];
for(var ii=0;ii<_doms[i].childNodes.length;ii++){
_data.push(DOMPurify.sanitize(_doms[i].childNodes[ii].textContent));
}
_data.push("https://www.poxiao.com"+_doms[i].childNodes[2].getAttribute("href"))
data.push(_data);
}
console.log(data)
chrome.tabs.sendMessage(sender.tab.id,{type:"list",value:data});
}
reader.readAsText(blob, 'GBK')
})
},
getData:function(message,sender,sendResponse){
fetch(message.value)
.then(response=>response.blob())
.then(blob=>{
let reader = new FileReader();
reader.onload = function(e) {
let htmlData = reader.result;
htmlData=(new window.DOMParser()).parseFromString(htmlData,"text/html");
console.log(htmlData);
let data={
info:[],
dl:[],
des:"",
name:""
};
let domInfos=htmlData.querySelector(".container .detail_intro tbody").querySelectorAll("tr");
for(var i=0;i<domInfos.length;i++){
var _doms=domInfos[i].querySelectorAll("td"),
_data=[];
for(var ii=0;ii<_doms.length;ii++){
if(_doms[ii].childNodes.length>1){
for(var iii=0;iii<_doms[ii].childNodes.length;iii++){
_data.push(DOMPurify.sanitize(_doms[ii].childNodes[iii].textContent));
}
}else{
_data.push(DOMPurify.sanitize(_doms[ii].textContent));
}
}
data.info.push(_data);
}

let domDls=htmlData.querySelector(".container #ziy .resourcesmain tbody").querySelectorAll("tr");
for(var i=0;i<domDls.length-1;i++){
var _data=[];
_data.push(DOMPurify.sanitize(domDls[i].querySelector("td ").textContent));
_data.push(DOMPurify.sanitize(domDls[i].querySelector("td input").value.substr(6)));
data.dl.push(_data)
}

data.des=DOMPurify.sanitize(htmlData.querySelectorAll(".filmcontents p")[1].textContent);
data.name=DOMPurify.sanitize(htmlData.querySelector(".container #film h1").childNodes[0].textContent);

chrome.tabs.sendMessage(sender.tab.id,{type:"data",value:data});
}
reader.readAsText(blob, 'GBK')
})
}
}
}
}
Expand Down
105 changes: 105 additions & 0 deletions js/inject/pxmovie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
console.log("pxmovie");
sue.apps.pxmovie={
cons:{},
initUI:function(){
let appInfo={
appName:"pxmovie",
headTitle:"pxmovie",
headCloseBtn:true,
}
sue.apps.init();
var dom=sue.apps.initBox(appInfo);
dom.id="su_apps_"+appInfo.appName;
sue.apps[appInfo.appName].dom=dom;
sue.apps.initPos(dom);

let theAppBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_pxmovie_box"]});
dom.querySelector(".su_main").appendChild(theAppBox);

theAppBox.appendChild(sue.apps.domCreate("div",{setName:["className"],setValue:["list"]},null,"display:none;"));
theAppBox.appendChild(sue.apps.domCreate("div",{setName:["className"],setValue:["data"]},null,"display:none;"));
theAppBox.appendChild(sue.apps.domCreate("img",{setName:["className","src"],setValue:["loading",chrome.runtime.getURL("/image/loading.gif")]}));

dom.style.cssText+="border-color:#d61717;";
dom.querySelector(".su_head").style.cssText+="background-color:#d61717;";
theAppBox.addEventListener("click",this.handleEvent,false);
chrome.runtime.sendMessage({type:"appsAction",app:"pxmovie",action:"getList"});
},
handleEvent:function(e){
switch(e.type){
case"click":
if(e.target.classList.contains("item")){
var _list=sue.apps.pxmovie.dom.querySelector(".list"),
_loading=sue.apps.pxmovie.dom.querySelector(".loading");
_list.style.cssText+="display:none;";
_loading.style.cssText+="display:block;";
chrome.runtime.sendMessage({type:"appsAction",app:"pxmovie",action:"getData",value:e.target.dataset.url});
}else if(e.target.classList.contains("back")){
var _list=sue.apps.pxmovie.dom.querySelector(".list"),
_data=sue.apps.pxmovie.dom.querySelector(".data"),
_back=sue.apps.pxmovie.dom.querySelector(".back");
_data.style.cssText+="display:none;";
_list.style.cssText+="display:block;";
}
break;
}
},
list:function(message){
let value=message.value,
dom=sue.apps.pxmovie.dom;
dom=dom.querySelector(".su_pxmovie_box");
let _boxList=dom.querySelector(".list"),
_loading=dom.querySelector(".loading"),
_ul=sue.apps.domCreate("ul");
_boxList.textContent="";
_boxList.appendChild(_ul);
for(var i=0;i<value.length;i++){
var _li=sue.apps.domCreate("li",{setName:["className"],setValue:["item"]},null,null,{setName:["url"],setValue:[value[i][3]]},"["+value[i][0]+"]"+value[i][2]);
_ul.appendChild(_li);
}
_loading.style.cssText+="display:none;";
_boxList.style.cssText+="display:block;";
},
data:function(message){
console.log(message)
let value=message.value,
dom=sue.apps.pxmovie.dom;
dom=dom.querySelector(".su_pxmovie_box");
let _data=dom.querySelector(".data"),
_loading=dom.querySelector(".loading"),
_name=sue.domCreate("div",{setName:["className"],setValue:["name"]},null,null,null,value.name),
_back=sue.apps.domCreate("button",{setName:["className"],setValue:["back"]},null,"display: inline-block;",null,sue.apps.i18n("back"));
_info=sue.apps.domCreate("div",{setName:["className"],setValue:["info"]});
_data.textContent="";
_data.appendChild(_name);
_data.appendChild(_back);
_data.appendChild(_info);

for(var i=0;i<value.info.length;i++){
var _infolist=sue.apps.domCreate("div")
_infolist.appendChild(sue.apps.domCreate("span",{setName:["className"],setValue:["infolist"]},null,null,null,value.info[i][0]));
_infolist.appendChild(sue.apps.domCreate("span",null,null,null,null,value.info[i][(i==7?4:1)]))
_info.appendChild(_infolist);
}
for(var i=0;i<value.dl.length;i++){
var _dl=sue.apps.domCreate("textarea",{setName:["className","value"],setValue:["url",value.dl[i][1]]});
_info.appendChild(_dl);
}
_info.appendChild(sue.apps.domCreate("div",{setName:["className"],setValue:["des"]},null,null,null,value.des));

_data.style.cssText+="display:block;";
_loading.style.cssText+="display:none;";
console.log(value);
}
}
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse) {
switch(message.type){
case"list":
sue.apps.pxmovie.list(message);
break;
case"data":
sue.apps.pxmovie.data(message);
break;
}
});
sue.apps.pxmovie.initUI();
3 changes: 2 additions & 1 deletion js/inject/rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ sue.apps.rss={
menu:function(dom){
console.log("subitem")
var domlist=sue.apps.getAPPboxEle(dom).querySelector(".sub_items");
domlist.textContent="";
//domlist.textContent="";
chrome.storage.local.get(function(items){
domlist.textContent="";
var feed=sue.apps.rss.config.feed;
var feedtitle=items.localConfig.apps.rss.feedtitle;
console.log(feedtitle)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"minimum_chrome_version": "22",
"name": "__MSG_ext_name__",
"short_name":"smartUp",
"version": "6.3.737.878",
"version": "6.3.744.881",
"description": "__MSG_ext_des__",
"default_locale": "en",
"author":"zimo",
Expand Down

0 comments on commit f2c7190

Please sign in to comment.