Add RSS event
This commit is contained in:
parent
fdf4cfad2d
commit
6a30b0a1e4
|
@ -0,0 +1,122 @@
|
|||
$(document).ready(function(){
|
||||
var result = '',
|
||||
title_text = '',
|
||||
link_text = '',
|
||||
summary_text = '',
|
||||
startDate_text = '',
|
||||
startMon_text = '',
|
||||
startDay_text = '',
|
||||
endDate_text = '',
|
||||
time_text = '',
|
||||
selet = 0,
|
||||
xmlLength = '',
|
||||
indexA = '',
|
||||
indexB = '',
|
||||
indexC = '',
|
||||
month = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
||||
checking = 1,
|
||||
$events = $('.events'),
|
||||
$mon = $('.events .mon'),
|
||||
$day = $('.events .day'),
|
||||
$link_text = $('.events .event_name'),
|
||||
$time = $('.events .event_info'),
|
||||
$next = $('.events .links_next'),
|
||||
$prev = $('.events .links_prev'),
|
||||
objLength = $events.find('ul > li').length;
|
||||
$next.on("click", function(){
|
||||
if (checking&&selet < xmlLength) {
|
||||
$('.links_prev').removeClass('disabled')
|
||||
selet+=objLength;
|
||||
$events.find('ul').fadeOut("fast", function () {
|
||||
resetText()
|
||||
$events.find('ul').fadeIn("fast" ,getEvent(selet));
|
||||
});
|
||||
if ((xmlLength-selet) == objLength) {
|
||||
$('.links_next').addClass('disabled')
|
||||
checking = 0;
|
||||
} else if ((xmlLength-selet) < objLength) {
|
||||
$('.links_next').addClass('disabled')
|
||||
checking = 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$prev.on("click", function(){
|
||||
if (selet > 0) {
|
||||
$('.links_next').removeClass('disabled')
|
||||
checking = 1;
|
||||
selet-=objLength;
|
||||
$events.find('ul').fadeOut("fast", function () {
|
||||
$events.find('ul').fadeIn("fast" ,getEvent(selet));
|
||||
});
|
||||
if ((xmlLength-selet) == xmlLength ) {
|
||||
$('.links_prev').addClass('disabled')
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
getEvent(selet);
|
||||
function resetText() {
|
||||
$events.find('li').find($mon).html('');
|
||||
$events.find('li').find($day).html('');
|
||||
$events.find('li').find($link_text).html('');
|
||||
$events.find('li').find($link_text).attr('href', '');
|
||||
$events.find('li').find($time).html('');
|
||||
}
|
||||
function getEvent(selet){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/static/Other.xml",
|
||||
dataType: "xml",
|
||||
timeout: 1000,
|
||||
error: function(xml){
|
||||
$events.find('.links_next').addClass('disabled')
|
||||
$events.find('.error_mag').show();
|
||||
$events.find('ul').hide();
|
||||
$events.find('.error_mag').html("讀取錯誤");
|
||||
},
|
||||
success: function(xml) {
|
||||
xmlLength = $(xml).find('entry').length;
|
||||
$(xml).find('entry').slice(selet, selet+objLength).each(function(i){
|
||||
title_text = $(this).find('title').text()
|
||||
link_text = $(this).find('link').attr('href')
|
||||
summary_text = $(this).find('summary').text()
|
||||
indexA = summary_text.indexOf("-");
|
||||
indexB = summary_text.indexOf(" ");
|
||||
indexC = summary_text.indexOf("/");
|
||||
//清除前後空白字元
|
||||
summary_text = jQuery.trim(summary_text);
|
||||
//篩選標題
|
||||
title_text = title_text.slice(0, 16)
|
||||
if (summary_text.length == 31) {
|
||||
startDate_text = summary_text.slice(0, indexA);
|
||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
||||
startDay_text = startDate_text.slice(7);
|
||||
endDate_text = summary_text.slice((indexA+1), indexB);
|
||||
time_text = summary_text.slice((indexB+1));
|
||||
} else {
|
||||
startDate_text = summary_text.slice(0, indexB);
|
||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
||||
startDay_text = startDate_text.slice(7);
|
||||
endDate_text = '';
|
||||
time_text = summary_text.slice((indexB+1));
|
||||
}
|
||||
if(startMon_text.slice(0, 1) == '0'){
|
||||
startMon_text = month[startMon_text.slice(1)-1];
|
||||
} else {
|
||||
startMon_text = month[startMon_text-1];
|
||||
}
|
||||
$events.find('li').eq(i).find($mon).html(startMon_text);
|
||||
$events.find('li').eq(i).find($day).html(startDay_text);
|
||||
$events.find('li').eq(i).find($link_text).html(title_text+"…");
|
||||
$events.find('li').eq(i).find($link_text).attr('href', link_text);
|
||||
$events.find('li').eq(i).find($time).html('時間:'+time_text);
|
||||
//console.log();
|
||||
/*$('<li></li>')
|
||||
.html('<div class="event_date"><span class="mon">'+startMon_text+'</span><span class="day">'+startDay_text+'</div>')
|
||||
.appendTo('.events ul');*/
|
||||
});//close each(
|
||||
}
|
||||
}); //close $.ajax(
|
||||
}
|
||||
});
|
|
@ -1,5 +1,3 @@
|
|||
<%= @part.inspect %><br/><br/>
|
||||
|
||||
<%= form_for @part, :url => admin_page_part_path(@part) do |f| %>
|
||||
|
||||
<% LIST[:page_part_kinds].each do |kind| %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% @site_valid_locales.each do |locale| %>
|
||||
<div>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale %>
|
||||
<%= f.text_area locale %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -64,6 +64,7 @@ module ParserBackEnd
|
|||
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>"
|
||||
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
|
||||
res << "<script type='text/javascript' src='/assets/event.js'></script>"
|
||||
page.design.javascripts.each do |js|
|
||||
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||
end
|
||||
|
|
|
@ -79,6 +79,7 @@ module ParserFrontEnd
|
|||
res << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>"
|
||||
res << "<script type='text/javascript' src='/assets/orbit-1.0.js'></script>"
|
||||
res << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>"
|
||||
res << "<script type='text/javascript' src='/assets/event.js'></script>"
|
||||
page.design.javascripts.each do |js|
|
||||
res << "<script type='text/javascript' src='#{js.file.url}'></script>"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<title>國立政治大學校園活動行事曆</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/" />
|
||||
<subtitle>其他類別-最新活動</subtitle>
|
||||
<dc:language>zh-tw</dc:language>
|
||||
<entry>
|
||||
<title>國立政治大學101學年度碩士班暨碩士在職專班招生考試</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2697&key2=20120225" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/02/25-101/02/26 07:00-17:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>國立中正大學101學年度碩士班招生考試</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2698&key2=20120310" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/10 07:00-17:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>「樂活飲食•健康之鑰」系列活動--膳食纖維的功用及食物來源</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2749&key2=20120229" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/02/29 12:00-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>「樂活飲食•健康之鑰」系列活動-美味的代價與健康問題之探討</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2750&key2=20120308" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/08 12:00-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>「樂活飲食•健康之鑰」系列活動--代謝症候群與檢康飲食</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2751&key2=20120322" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/22 12:00-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>「學生健康體位控制班」</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2766&key2=20120301" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/01-101/05/03 18:00-20:30</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>學生大使志工團- 2012 Field Trip-Must Sea+ FUN舟趣</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2768&key2=20120317" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/17-101/03/18 08:00-20:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>職場勞資關係講座-你知道自己的權益嗎?</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2776&key2=20120305" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/05 18:30-21:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>職場「面面」觀 - 談職場趨勢與面試</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2791&key2=20120306" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/06 18:30-21:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>「自」銷不要「滯」銷~一窺自我行銷術的秘密</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2792&key2=20120307" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/07 18:30-21:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>職涯經驗談-開創職涯的一片天</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2793&key2=20120308" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/08 18:30-21:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>2012徵政好企業說明會--花旗銀行</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2795&key2=20120305" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/05 12:15-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>2012徵政好企業說明會--日商野村總合研究所</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2796&key2=20120309" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/09 12:15-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>2012徵政好企業說明會--渣打銀行</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2797&key2=20120306" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/06 12:15-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>2012徵政好企業說明會--台新金控</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2798&key2=20120307" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/07 12:15-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>2012徵政好企業說明會--第一銀行</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2799&key2=20120308" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/08 12:15-14:00</summary>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>101年生命教育師資培訓課程研習會</title>
|
||||
<link rel="alternate" href="http://events.nccu.edu.tw/more.do?key=2800&key2=20120324" />
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<summary type="text">101/03/24-101/03/25 07:30-17:40</summary>
|
||||
</entry>
|
||||
</feed>
|
||||
|
Loading…
Reference in New Issue