var action = ($action ?? $0 ?? 'notice'); //'notify, prompt, auto'
var SubscribeType = ($subscribe ?? $1 ?? 1); // 1= This page only, 2 = This as Sub-Pages
var text = ($text ?? $2 ?? ''); // Text to display for the prompt or notice
var timeout = (($timeout ?? $3 ?? 5) * 1000);
if(text == '') {
if(action == 'notice') {
let text = 'You are not subscribed to this page. Please subscribe to this page to recieve notification of a change.';
} else if(action == 'prompt') {
let text = 'Would you like to subscribe to this page?';
} else {
let text = 'You have been automatically subscribed to receive notifications if this page changes.';
}
}
// We need the id of the current page.
var pageID = page.id;
<div class="promptme">(text)</div>
<html><head>
<script type="text/javascript">"
var action = "..json.emit(action)..";
var SubscribeType = "..json.emit(SubscribeType)..";
var text = "..json.emit(text)..";
var timeout = "..json.emit(timeout)..";
$(document).ready(function() {
if($('div#deki-page-alerts a span.status').text() == 'Off') {
if(action == 'prompt') {
if(Confirmit(text)){
SetSubscription();
}
} else if(action =='notice') {
$('.promptme').fadeIn().idle(timeout).fadeOut('slow');
} else if(action == 'auto') {
SetSubscription();
}
}
});
function Confirmit(TheText) {
return confirm(TheText);
}
function SetSubscription() {
var pid = "..json.emit(pageID)..";
var subType = "..json.emit(SubscribeType)..";
var siteURI = "..json.emit(site.uri)..";
Deki.$.ajax({
type: 'POST',
url: siteURI + '/deki/gui/pageactions.php',
dataType: 'application/json',
data: {'action':'setalerts', 'pageId': pid, 'status':subType},
complete: function(data, status){
if(status == 'success') {
$('.promptme').fadeIn().idle(timeout).fadeOut('slow');
}
}
});
}
jQuery.fn.RefreshMe = function() {
window.location = window.location;
};
/* create a timeOut function in jQuery */
jQuery.fn.idle = function(time){
return this.each(function(){
var i = $(this);
i.queue(function(){
setTimeout(function(){
i.dequeue();
}, time);
});
});
};
"</script>
<style type="text/css">"
.promptme {
border-color: #666666;
border: solid;
background-color: rgba(0,0,0,.8);
height: 100px;
width: 200px;
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
padding: 10px;
color: white;
display: none;
}
"</style>
</head></html>
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by