📄 index.aspx
字号:
var el = getReal(event.srcElement, "className", "dragBoxContent");
if (el == null) {
theobject = null;
return;
}
dir = getDirection(el);
if (dir == "") return;
theobject = new resizeObject();
theobject.el = el;
theobject.dir = dir;
theobject.grabx = window.event.clientX;
theobject.graby = window.event.clientY;
theobject.width = el.offsetWidth;
theobject.height = el.offsetHeight;
theobject.left = el.offsetLeft;
theobject.top = el.offsetTop;
window.event.returnValue = false;
window.event.cancelBubble = true;
}
function doUp() {
if (theobject != null) {
theobject = null;
}
}
function doMove() {
var el, xPos, yPos, str, xMin, yMin;
xMin = 8;
yMin = 8;
el = getReal(event.srcElement, "className", "dragBoxContent");
if(el!=null){
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;
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_DragBox[i].split('|');
userChannel[i]=new Array();
userChannel[i][0]=_cookie_DragBoxInfoArray[0];
userChannel[i][1]=_cookie_DragBoxInfoArray[1];
userChannel[i][2]=_cookie_DragBoxInfoArray[2];
userChannel[i][3]=_cookie_DragBoxInfoArray[3];
userChannel[i][4]=_cookie_DragBoxInfoArray[4];
userChannel[i][5]=_cookie_DragBoxInfoArray[5];
userChannel[i][6]=_cookie_DragBoxInfoArray[6];
userChannel[i][7]=_cookie_DragBoxInfoArray[7];
userChannel[i][8]=_cookie_DragBoxInfoArray[8];
userChannel[i][9]=_cookie_DragBoxInfoArray[9];
userChannel[i][10]=_cookie_DragBoxInfoArray[10];
var userChannelObj=CreateDragBox(userChannel[i]);
DragBoxArray.push(userChannelObj);
}
}
return true;
}
function UpdateDragBox(dragBoxId,itemOrder,itemValue){
for(var k=0;k<userChannel.length;k++){
if(dragBoxId=="rss_"+userChannel[k][0].toString()){
userChannel[k][itemOrder]=itemValue;
}
}
SaveCookie();
}
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){
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;
var cookie=new Cookie();
if(arguments[0]==null){
var _cookie_layout=cookie.getCookie("HoWave_Layout");
if(_cookie_layout!=""&&_cookie_layout!=null){
rowNums=parseInt(_cookie_layout);
var m_ContainerSelect=document.getElementById("ContainerNums");
for(var n=0;n<m_ContainerSelect.length;n++){
var op=m_ContainerSelect.options[n]
if(op.value==rowNums){
op.selected=true;
break;
}
}
}
else
rowNums=3;
}
else
rowNums=arguments[0];
cookie.setCookie("HoWave_Layout",rowNums,nextmonth);
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<userChannel.length;i++){
var objRssCol=userChannel[i][4];
var objRssRow=userChannel[i][5];
if(objRssRow==m && objRssCol==ColNums){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -