📄 howave_index.js
字号:
if (el.className == "dragBoxContent") {
str = getDirection(el);
if (str == "") str = "default";
else str += "-resize";
el.style.cursor = str;
}
}
if(theobject != null ) {
var _DragBox=theobject.el.parentNode;
if (dir.indexOf("e") != -1){
theobject.el.style.width = Math.max(xMin, theobject.width + window.event.clientX - theobject.grabx) + "px";
}
if (dir.indexOf("s") != -1)
theobject.el.style.height = Math.max(yMin, theobject.height + window.event.clientY - theobject.graby) + "px";
if (dir.indexOf("w") != -1) {
theobject.el.style.left = Math.min(theobject.left + window.event.clientX - theobject.grabx, theobject.left + theobject.width - xMin) + "px";
theobject.el.style.width = Math.max(xMin, theobject.width - window.event.clientX + theobject.grabx) + "px";
}
if (dir.indexOf("n") != -1) {
theobject.el.style.top = Math.min(theobject.top + window.event.clientY - theobject.graby, theobject.top + theobject.height - yMin) + "px";
theobject.el.style.height = Math.max(yMin, theobject.height - window.event.clientY + theobject.graby) + "px";
}
theobject.el.style.width=(parseInt(theobject.el.style.width)<160)?(160+"px"):theobject.el.style.width;
_DragBox.style.width=theobject.el.style.width;
window.event.returnValue = false;
window.event.cancelBubble = true;
}
}
function getReal(el, type, value) {
temp = el;
while ((temp != null) && (temp.tagName != "BODY")) {
if (eval("temp." + type) == value) {
el = temp;
return el;
}
else{
return null;
}
}
return el;
}
document.onmousemove = selectMove;
document.onmouseout=selectMove;
document.onmousedown=selectMove;
document.onmouseup =selectMove;
function selectMove(ev){
var selectTarget;
if(slectType!="undefined"){
ev = ev || window.event;
var starget = ev.target || ev.srcElement;
if(starget.getAttribute('DragObj')!=null){
slectType="Drag";
}
else if(starget.getAttribute('ResizeObj')!=null){
slectType="Resize";
}
else{
slectType="ALL";
}
selectTarget=starget.id
if(slectType=="Drag"){
document.onmousemove = mouseMove;
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
}
if(slectType=="Resize"){
document.onmousemove = doMove;
document.onmousedown =doDown;
document.onmouseup =doUp;
}
}
}
function selectDown(){
if(slectType!="undefined"){
if(slectType=="Drag"){
document.onmousemove = mouseMove;
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
}
if(slectType=="Resize"){
document.onmousemove = doMove;
document.onmousedown =doDown;
document.onmouseup =doUp;
}
}
}
function selectUp(){
if(slectType!="undefined"){
if(slectType=="Drag"){
document.onmousemove = mouseMove;
document.onmousedown = mouseDown;
document.onmouseup = mouseUp;
}
if(slectType=="Resize"){
document.onmousemove = doMove;
document.onmousedown =doDown;
document.onmouseup =doUp;
}
}
}
document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var j = 0; j < elem.length; j++) {
var classes = elem[j].className;
if (myclass.test(classes)) retnode.push(elem[j]);
}
return retnode;
}
function initContainer(){
dragHelper = document.createElement('DIV');
dragHelper.setAttribute("id","dragHelper_1");
dragHelper.style.cssText = 'position:absolute;display:none;';
if(arguments.length>0){
Layout(arguments[0]);
}
else
{
if(GetCookieLayout()){
}
else{
loadChannel();
}
window.setTimeout(Layout,500);
}
document.body.appendChild(dragHelper);
page = new Page();
var _cookies=new Cookie();
var _h_title=_cookies.getCookie("howave_myspace_title");
if(_h_title!=null&& _h_title!="")
document.getElementById("myTitle").value=_h_title;
}
function loadChannel(){
var _ajax_=new HttpAjax();
_xmlReq_ = _ajax_.create("Passport/WebService.ashx?Action=GetPublicRssList&Rnd="+Math.random(), load_Rsscallback, load_onError);
}
function load_Rsscallback(rValue){
var rssContent=rValue.responsexml;
var channels=rssContent.getElementsByTagName("item");
for(var i=0;i<channels.length;i++){
userChannel[i]=new Array();
userChannel[i][0]=channels[i].getElementsByTagName("id")[0].firstChild.nodeValue;
userChannel[i][1]=channels[i].getElementsByTagName("title")[0].firstChild.nodeValue;
userChannel[i][2]=channels[i].getElementsByTagName("link")[0].firstChild.nodeValue;
userChannel[i][3]=channels[i].getElementsByTagName("nums")[0].firstChild.nodeValue;
userChannel[i][4]=channels[i].getElementsByTagName("col")[0].firstChild.nodeValue;
userChannel[i][5]=channels[i].getElementsByTagName("row")[0].firstChild.nodeValue;
userChannel[i][6]=channels[i].getElementsByTagName("width")[0].firstChild.nodeValue;
userChannel[i][7]=channels[i].getElementsByTagName("height")[0].firstChild.nodeValue;
userChannel[i][8]=channels[i].getElementsByTagName("articleType")[0].firstChild.nodeValue;
userChannel[i][9]=channels[i].getElementsByTagName("top")[0].firstChild.nodeValue;
userChannel[i][10]=channels[i].getElementsByTagName("left")[0].firstChild.nodeValue;
var userChannelObj=CreateDragBox(userChannel[i]);
DragBoxArray.push(userChannelObj);
//Cookie("ChannelArray")="id|title|rssurl|rssnum|col|row|width|height|type|top|left"
}
}
function load_onError(){
}
function GetCookieLayout(){
var cookie=new Cookie();
var _cookie_layout=cookie.getCookie("HoWave_Layout");
var _cookie_ChannelArray=cookie.getCookie("HoWave_ChannelArray");
if(_cookie_layout==null||_cookie_layout==""||_cookie_ChannelArray==null||_cookie_ChannelArray=="")
return false;
var _cookie_DragBox=new Array();
var _cookie_DragBoxInfo=new Array();
if(_cookie_ChannelArray.length>0 && _cookie_ChannelArray.indexOf(',')>0){
_cookie_DragBox=_cookie_ChannelArray.split(',');
for(var i=0;i<_cookie_DragBox.length;i++){
var _cookie_DragBoxInfoArray=_cookie_DragBoxInfo.split('|');
_cookie_DragBoxInfo[i]=new Array();
_cookie_DragBoxInfo[i][0]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][1]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][2]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][3]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][4]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][5]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][6]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][7]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][8]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][9]=_cookie_DragBoxInfoArray[0];
_cookie_DragBoxInfo[i][10]=_cookie_DragBoxInfoArray[0];
var userChannelObj=CreateDragBox(_cookie_DragBoxInfo[i]);
DragBoxArray.push(userChannelObj);
}
}
}
return true;
}
function SaveLayout(rowNums){
var cookie=new Cookie();
cookie.setCookie("HoWave_Layout",rowNums,nextmonth);
}
function SaveChannel(channelValue){
var cookie=new Cookie();
cookie.setCookie("HoWave_ChannelArray",channelValue,nextmonth);
}
var _ranTime=100;
function Delay(url,id){
_ranTime=_ranTime+400;
window.setTimeout(_GetRss(url,id), _ranTime);
}
function _GetRss(url,id){
return function(){
GetRss(url,id);
}
}
var _ranTimeStatus;
function GetRss(url,id){
_ranTimeStatus=_ranTimeStatus+"|"+_ranTime;
window.status=_ranTimeStatus;
var _ajax_=new HttpAjax();
_xmlReq_ = _ajax_.updateContent("Passport/WebService.ashx?Action=GetRssContent&rssurl="+url+"&Rnd="+Math.random(),id);
}
function GetJs(url,id){
var _script=document.createElement("script");
_script.src=url;
document.getElementById(id).appendChild(_script);
}
function Layout(){
var rowNums;
if(arguments[0]==null)
rowNums=3;
else
rowNums=arguments[0];
var cookie=new Cookie();
cookie.setCookie("HoWave_Layout",rowNums);
var _pageContent=document.getElementById("PageContent");
cleanWhiteSpace(_pageContent);
var _PageContentChildNodes=_pageContent.childNodes.length;
for(var k=_PageContentChildNodes;k>0;k--){
_pageContent.removeChild(_pageContent.childNodes[k-1]);
}
if(rowNums==0){
for(var i=0;i<DragBoxArray.length;i++){
var objRssID=userChannel[i][0];
DragBoxArray[i].style.width="300px";
DragBoxArray[i].style.position="absolute";
_pageContent.appendChild(DragBoxArray[i]);
}
}else{
layoutType="normal";
var _contentWidth=parseInt(100/rowNums)-1.5;
for(var i=0;i<rowNums;i++){
var _dragContainer=document.createElement('div');
_dragContainer.className='DragContainer';
_dragContainer.setAttribute('id','DragContainer'+i);
_dragContainer.style.width=_contentWidth+"%";
_pageContent.appendChild(_dragContainer);
PushBoxInContainer(_dragContainer,i,rowNums);
}
var _clear=document.createElement('div');
_clear.className="both";
_pageContent.appendChild(_clear);
document.body.appendChild(_pageContent);
var _bottom_=document.getElementById("bottom");
_bottom_.style.display="block";
document.body.appendChild(_bottom_);
CreateDragContainer();
}
}
function PushBoxInContainer(DragBoxContainer,ColNums,MaxCol){
for(var m=0;m<10;m++){
for(var i=0;i<DragBoxArray.length;i++){
var objRssCol=userChannel[i][4];
var objRssRow=userChannel[i][5];
if(objRssRow==m && objRssCol==ColNums+1){
(DragBoxArray[i].childNodes[1]).style.width="99%";
(DragBoxArray[i].childNodes[1]).style.height="auto";
DragBoxArray[i].style.position="";
DragBoxArray[i].style.width="100%";
DragBoxContainer.appendChild(DragBoxArray[i]);
}
else if(objRssCol>MaxCol)
DragBoxContainer.appendChild(DragBoxArray[i]);
}
}
}
function insertAt(parentNode,newNode,index){
if(!parentNode.hasChildNodes()){
parentNode.appendChild(newNode);
return newNode;
}
try{
parentNode.insertBefore(newNode,parentNode.childNodes[index]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -