Skip to content

Instantly share code, notes, and snippets.

@godshades
Created December 5, 2017 13:46
Show Gist options
  • Save godshades/f66f64b54f901762367121bdf20e5cc7 to your computer and use it in GitHub Desktop.
Save godshades/f66f64b54f901762367121bdf20e5cc7 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.min.css' rel='stylesheet' />
<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.3/moment.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js'></script>
<script>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
displayEventTime: false,
editable: true,
events: [{
title: 'CGV tăng 3',
start: '22:00',
dow: [1, 2, 3, 4, 5],
url: 'https://rapchieuphim.com/khuyen-mai/xem-phim-tang-3-gia-chi-50k-tai-cgv'
},
{
title: 'Beta - Thứ Ba vui vẻ',
start: '08:30',
dow: [2],
url: 'https://moveek.com/khuyen-mai/beta-cineplex-thu-ba-vui-ve/'
},
{
title: 'Lotte LOVELY TUESDAY',
start: '08:30',
dow: [2],
url: 'https://lottecinemavn.com/vi-vn/su-kien/lovely-tuesday-(tu-15-09).aspx'
},
{
title: 'Platinum Special Couple\'s Day',
start: '10:00',
dow: [2],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/special-couple-s-day'
},
{
title: 'Platinum Special Thursday',
start: '10:00',
dow: [4],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/n-a'
},
{
title: 'Platinum ladies\' night',
start: '10:00',
dow: [3],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/ladies-night'
},
],
eventClick: function(event) {
if (event.url) {
window.open(event.url);
return false;
}
},
eventRender: function(event, element) {
element.find('.fc-title').append("<br/>");
}
});
// adding a every monday and wednesday events:
$('#calendar').fullCalendar('addEventSource',
function(start, end, timezone, callback) {
var events = [];
var y = start._d.getFullYear(),
m = start._d.getMonth();
var firstDay = new Date(y, m, 1);
var lastDay = new Date(y, m + 1, 0);
var test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() - 1);
}
// Last monday of last month
if (test_date.is().monday()) {
events.push({
title: 'CGV CULTURE DAY',
start: '08:30',
start: test_date,
url: 'https://www.cgv.vn/default/newsoffer/cgv-culture-day/'
}, // CGV
{
title: 'Lotte Big Smile Day',
start: '08:30',
start: test_date,
url: 'https://lottecinemavn.com/vi-vn/su-kien/e-l-selection/big-smile-day-45,000-50,000-%C4%91ong-ve-xem-phim-t.aspx'
} // lottecinema
);
}
y = end._d.getFullYear(),
m = end._d.getMonth() - 1;
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() - 1);
}
// Last monday of current month
if (test_date.is().monday()) {
events.push({
title: 'CGV CULTURE DAY',
start: '08:30',
start: test_date,
url: 'https://www.cgv.vn/default/newsoffer/cgv-culture-day/'
}, // CGV
{
title: 'Lotte Big Smile Day',
start: '08:30',
start: test_date,
url: 'https://lottecinemavn.com/vi-vn/su-kien/e-l-selection/big-smile-day-45,000-50,000-%C4%91ong-ve-xem-phim-t.aspx'
} // lottecinema
);
}
// First wednesday current month
y = start._d.getFullYear(),
m = start._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 3) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().wednesday()) {
events.push({
title: 'BHD B\'DAY',
start: '08:30',
start: test_date,
url: 'http://www.bhdstar.vn/deals/bday-2/'
});
}
// First wednesday next month
y = end._d.getFullYear(),
m = end._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(firstDay);
while (test_date.getDay() !== 3) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().wednesday()) {
events.push({
title: 'BHD B\'DAY',
start: '08:30',
start: test_date,
url: 'http://www.bhdstar.vn/deals/bday-2/'
});
}
// First monday current month
y = start._d.getFullYear(),
m = start._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().monday()) {
events.push({
title: 'Beta - MAD SALE DAY',
start: '08:30',
start: test_date,
url: 'https://betacineplex.vn/tin-moi/bung-no-voi-mad-sale-day/118'
});
}
// First monday next month
y = end._d.getFullYear(),
m = end._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(firstDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().monday()) {
events.push({
title: 'Beta - MAD SALE DAY',
start: '08:30',
start: test_date,
url: 'https://betacineplex.vn/tin-moi/bung-no-voi-mad-sale-day/118'
});
}
// return events generated
callback(events);
}
);
});
</script>
<style>
body {
margin: 40px 10px;
padding: 0;
font-family: 'Roboto', sans-serif;
font-size: 14px;
}
#calendar {
margin: 0 auto;
}
.fc-title {
white-space: normal;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.min.css' rel='stylesheet' />
<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.3/moment.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.7.0/fullcalendar.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js'></script>
<script>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
displayEventTime: false,
editable: true,
events: [{
title: 'CGV tăng 3',
start: '22:00',
dow: [1, 2, 3, 4, 5],
url: 'https://rapchieuphim.com/khuyen-mai/xem-phim-tang-3-gia-chi-50k-tai-cgv'
},
{
title: 'Beta - Thứ Ba vui vẻ',
start: '08:30',
dow: [2],
url: 'https://moveek.com/khuyen-mai/beta-cineplex-thu-ba-vui-ve/'
},
{
title: 'Lotte LOVELY TUESDAY',
start: '08:30',
dow: [2],
url: 'https://lottecinemavn.com/vi-vn/su-kien/lovely-tuesday-(tu-15-09).aspx'
},
{
title: 'Platinum Special Couple\'s Day',
start: '10:00',
dow: [2],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/special-couple-s-day'
},
{
title: 'Platinum Special Thursday',
start: '10:00',
dow: [4],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/n-a'
},
{
title: 'Platinum ladies\' night',
start: '10:00',
dow: [3],
url: 'https://platinumcineplex.vn/vi/news/news-and-promotion/ladies-night'
},
],
eventClick: function(event) {
if (event.url) {
window.open(event.url);
return false;
}
},
eventRender: function(event, element) {
element.find('.fc-title').append("<br/>");
}
});
// adding a every monday and wednesday events:
$('#calendar').fullCalendar('addEventSource',
function(start, end, timezone, callback) {
var events = [];
var y = start._d.getFullYear(),
m = start._d.getMonth();
var firstDay = new Date(y, m, 1);
var lastDay = new Date(y, m + 1, 0);
var test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() - 1);
}
// Last monday of last month
if (test_date.is().monday()) {
events.push({
title: 'CGV CULTURE DAY',
start: '08:30',
start: test_date,
url: 'https://www.cgv.vn/default/newsoffer/cgv-culture-day/'
}, // CGV
{
title: 'Lotte Big Smile Day',
start: '08:30',
start: test_date,
url: 'https://lottecinemavn.com/vi-vn/su-kien/e-l-selection/big-smile-day-45,000-50,000-%C4%91ong-ve-xem-phim-t.aspx'
} // lottecinema
);
}
y = end._d.getFullYear(),
m = end._d.getMonth() - 1;
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() - 1);
}
// Last monday of current month
if (test_date.is().monday()) {
events.push({
title: 'CGV CULTURE DAY',
start: '08:30',
start: test_date,
url: 'https://www.cgv.vn/default/newsoffer/cgv-culture-day/'
}, // CGV
{
title: 'Lotte Big Smile Day',
start: '08:30',
start: test_date,
url: 'https://lottecinemavn.com/vi-vn/su-kien/e-l-selection/big-smile-day-45,000-50,000-%C4%91ong-ve-xem-phim-t.aspx'
} // lottecinema
);
}
// First wednesday current month
y = start._d.getFullYear(),
m = start._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 3) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().wednesday()) {
events.push({
title: 'BHD B\'DAY',
start: '08:30',
start: test_date,
url: 'http://www.bhdstar.vn/deals/bday-2/'
});
}
// First wednesday next month
y = end._d.getFullYear(),
m = end._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(firstDay);
while (test_date.getDay() !== 3) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().wednesday()) {
events.push({
title: 'BHD B\'DAY',
start: '08:30',
start: test_date,
url: 'http://www.bhdstar.vn/deals/bday-2/'
});
}
// First monday current month
y = start._d.getFullYear(),
m = start._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(lastDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().monday()) {
events.push({
title: 'Beta - MAD SALE DAY',
start: '08:30',
start: test_date,
url: 'https://betacineplex.vn/tin-moi/bung-no-voi-mad-sale-day/118'
});
}
// First monday next month
y = end._d.getFullYear(),
m = end._d.getMonth();
firstDay = new Date(y, m, 1);
lastDay = new Date(y, m + 1, 0);
test_date = new Date(firstDay);
while (test_date.getDay() !== 1) {
test_date.setDate(test_date.getDate() + 1);
}
if (test_date.is().monday()) {
events.push({
title: 'Beta - MAD SALE DAY',
start: '08:30',
start: test_date,
url: 'https://betacineplex.vn/tin-moi/bung-no-voi-mad-sale-day/118'
});
}
// return events generated
callback(events);
}
);
});
</script>
<style>
body {
margin: 40px 10px;
padding: 0;
font-family: 'Roboto', sans-serif;
font-size: 14px;
}
#calendar {
margin: 0 auto;
}
.fc-title {
white-space: normal;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment