Skip to content

Commit

Permalink
Item14337: Use relative paths, and pub js files
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed Mar 4, 2017
1 parent e6a4b04 commit a4ddd17
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 104 deletions.
4 changes: 2 additions & 2 deletions core/data/System/CompleteDocumentation.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1434574342" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1488593563" format="1.1" version="1"}%
---+!! Reference Manual (%WIKIVERSION%)

This page contains all documentation topics as one long, complete reference sheet.
Expand All @@ -8,7 +8,7 @@ This page contains all documentation topics as one long, complete reference shee
%BUTTON{
"%MAKETEXT{"Load content"}%"
icon="book"
onclick="window.location.href='%SCRIPTURL{"view"}%/%WEB%/%TOPIC%?section=content';"
onclick="window.location.href='%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?section=content';"
}% %MAKETEXT{"Use this button to load the content.%BR% *Caution* the content is very large and loading it will put a high load on your browser. Only load the content if you are going to print it - otherwise use the [[ReferenceManual][online reference manual]]."}%

<verbatim class="foswikiHidden">
Expand Down
112 changes: 10 additions & 102 deletions core/data/System/SiteChanges.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1434484983" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1488593563" format="1.1" version="1"}%
%META:TOPICPARENT{name="UserToolsCategory"}%
---+ %TOPIC%
Recent changes
Expand All @@ -10,7 +10,7 @@ performance.</div>'}%
%BUTTON{
"%MAKETEXT{"Load content"}%"
icon="book"
onclick="window.location.href='%SCRIPTURL{"view"}%/%WEB%/%TOPIC%?section=content';"
onclick="window.location.href='%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?section=content';"
}% %MAKETEXT{"Use this button to load the content.%BR% *Caution* the search on this topic can be very resource intensive. Only load the content if you really need it, otherwise review the WebChanges topic from each web."}%

<verbatim class="foswikiHidden">
Expand Down Expand Up @@ -101,112 +101,20 @@ performance.</div>'}%
</div>
</div>
</noautolink>
</form>%ADDTOZONE{
</form>
%ADDTOZONE{ "script"
id="SiteChangesScript"
requires="JavascriptFiles/foswikiPrefs"
text="<script type='text/javascript' src='%PUBURLPATH{"sitechanges.js" topic="%BASEWEB%.%BASETOPIC%"}%'></script>"
}%
%ADDTOZONE{
"head"
id="sitechanges"
text="<literal><style type='text/css' media='all'>
#siteChangesForm .foswikiTable {
margin-top: 20px;
}
</style></literal>"
}%%ADDTOZONE{
"script"
id="sitechanges"
text="<literal><script type='text/javascript'>
(function($) {

var DEBUG;

function updateLastTimeCheckedOption (inDate) {
var el = document.getElementById('last_time_checked');
if (el) {
el.value = inDate;
el.text = 'last time I checked';
}
}

function setOptionSelected (inId) {
if (DEBUG && console) {
console.log('setOptionSelected:inId=' + inId);
}
var el = document.getElementById(inId);
if (el) {
el.selected = 'selected';
}
}

function processFormValue (inValue) {
if (DEBUG && console) {
console.log('submitted:' + inValue);
}
return true;
}

// stores the name
function storeSelectedOption (inName, inValue, inStorageField) {
if (DEBUG && console) {
console.log('storeSelectedOption:inName=' + inName + ';inValue=' + inValue + ';inStorageField=' + inStorageField);
}
// store readable value so we can use it when reloading the page
inStorageField.value=inName;
return true;
}

function init() {
var DEFAULT_OPTION_ID = '24_hours_ago';

var dateLastCheck = foswiki.Pref.getPref('WebChangesForAllWebs_dateLastCheck');
if (dateLastCheck) {
var selectedOption = $('input[name=\"sinceReadable\"]').val();
if (DEBUG && console) {
console.log('sinceReadable selectedOption:' + selectedOption);
}
if (selectedOption) {
setOptionSelected(selectedOption);
} else {
setOptionSelected(DEFAULT_OPTION_ID);
}
}
var d = new Date();
var now = d.getFullYear() + '-' +
(d.getMonth() + 1) + '-' +
d.getDate() + ' ' +
d.getHours() + ':' +
d.getMinutes() + ':' +
d.getSeconds();
now = now.replace(/([-: ])(\d)([-: ]|$)/g, '$1\60$2$3');
if (DEBUG && console) {
console.log('now:' + now);
}
if (now) {
foswiki.Pref.setPref(foswiki.getPreference('WEB') +
'_' + foswiki.getPreference('TOPIC') +
'_dateLastCheck', now);
updateLastTimeCheckedOption(now);
}
}

function submitForm() {
document.forms.seeChangesSince.web.value = document.forms.seeChangesSince.web.value.replace(/\s*,\s*/, ', ');
processFormValue(document.forms.seeChangesSince.since.value);
document.forms.seeChangesSince.submit();
}

$(function() {
DEBUG = $(\"input[name='debugJs']\").val();
$('#siteChangesSelect').change(function() {
var $selected = $('option:selected', this);
storeSelectedOption($selected.attr('id'), $selected.attr('value'), document.forms.seeChangesSince.sinceReadable);
submitForm();
});
$(document.forms.seeChangesSince).submit(function() {
submitForm();
});
init();
});
}(jQuery));
</script></literal>"
requires="JavascriptFiles/foswikiPrefs"
}%<!-- END DATE SELECTION -->
}%
%ENDSECTION{"content"}%
</verbatim>
3 changes: 3 additions & 0 deletions core/lib/Foswiki/Contrib/core/MANIFEST
Expand Up @@ -781,6 +781,9 @@ pub/System/ProjectLogos/foswiki-logo.png 0644
pub/System/ProjectLogos/foswiki-logo-large.png 0644
pub/System/ProjectLogos/foswiki-logo-icon.png 0644
pub/System/ProjectLogos/foswiki-poweredby.gif 0644
pub/System/SiteChanges/sitechanges.js 0644
pub/System/SiteChanges/sitechanges.js.gz 0644
pub/System/SiteChanges/sitechanges.uncompressed.js 0644
pub/System/Skins/js.js 0644
pub/System/SkinTemplates/base.css 0644
pub/System/SkinTemplates/base.css.gz 0644
Expand Down
93 changes: 93 additions & 0 deletions core/pub/System/SiteChanges/sitechanges.uncompressed.js
@@ -0,0 +1,93 @@
(function($) {

var DEBUG;

function updateLastTimeCheckedOption (inDate) {
var el = document.getElementById('last_time_checked');
if (el) {
el.value = inDate;
el.text = 'last time I checked';
}
}

function setOptionSelected (inId) {
if (DEBUG && console) {
console.log('setOptionSelected:inId=' + inId);
}
var el = document.getElementById(inId);
if (el) {
el.selected = 'selected';
}
}

function processFormValue (inValue) {
if (DEBUG && console) {
console.log('submitted:' + inValue);
}
return true;
}

// stores the name
function storeSelectedOption (inName, inValue, inStorageField) {
if (DEBUG && console) {
console.log('storeSelectedOption:inName=' + inName + ';inValue=' + inValue + ';inStorageField=' + inStorageField);
}
// store readable value so we can use it when reloading the page
inStorageField.value=inName;
return true;
}

function init() {
var DEFAULT_OPTION_ID = '24_hours_ago';

var dateLastCheck = foswiki.Pref.getPref('WebChangesForAllWebs_dateLastCheck');
if (dateLastCheck) {
var selectedOption = $('input[name="sinceReadable"]').val();
if (DEBUG && console) {
console.log('sinceReadable selectedOption:' + selectedOption);
}
if (selectedOption) {
setOptionSelected(selectedOption);
} else {
setOptionSelected(DEFAULT_OPTION_ID);
}
}
var d = new Date();
var now = d.getFullYear() + '-' +
(d.getMonth() + 1) + '-' +
d.getDate() + ' ' +
d.getHours() + ':' +
d.getMinutes() + ':' +
d.getSeconds();
now = now.replace(/([-: ])(\d)([-: ]|$)/g, '$1\60$2$3');
if (DEBUG && console) {
console.log('now:' + now);
}
if (now) {
foswiki.Pref.setPref(foswiki.getPreference('WEB') +
'_' + foswiki.getPreference('TOPIC') +
'_dateLastCheck', now);
updateLastTimeCheckedOption(now);
}
}

function submitForm() {
document.forms.seeChangesSince.web.value = document.forms.seeChangesSince.web.value.replace(/\s*,\s*/, ', ');
processFormValue(document.forms.seeChangesSince.since.value);
document.forms.seeChangesSince.submit();
}

$(function() {
DEBUG = $("input[name='debugJs']").val();
$('#siteChangesSelect').change(function() {
var $selected = $('option:selected', this);
storeSelectedOption($selected.attr('id'), $selected.attr('value'), document.forms.seeChangesSince.sinceReadable);
submitForm();
});
$(document.forms.seeChangesSince).submit(function() {
submitForm();
});
init();
});
}(jQuery));

0 comments on commit a4ddd17

Please sign in to comment.