Skip to content

Commit 7cc7fd2

Browse files
committed
first version of phpfreechat-mini theme
1 parent e81dbeb commit 7cc7fd2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2115
-3
lines changed

client/pfc-init.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
3030
// load the interface
3131
pfc.loadHTML();
3232
pfc.loadResponsiveBehavior();
33+
pfc.loadThemeUI();
3334

3435
// run quick tests
3536
pfc.checkServerConfig(pfc.startChatLogic);
@@ -81,7 +82,7 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
8182
* Test the rewrite rules are enabled on the server
8283
*/
8384
pfc.checkServerConfigRewrite = function (next) {
84-
var err_rewrite_msg = 'mod_rewrite must be enabled server side and correctly configured. "RewriteBase" could be adjusted in server/.htaccess file.';
85+
var err_rewrite_msg = '.htaccess must be allowed on your server (AllowOverride All) and mod_rewrite must be enabled on your server and correctly configured ("RewriteBase" could be adjusted in server/.htaccess file)';
8586
$.ajax({
8687
type: 'GET',
8788
url: pfc.options.serverUrl + '/status'
@@ -342,7 +343,7 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
342343

343344
/**
344345
* For mobile ergonomics
345-
**/
346+
*/
346347
pfc.loadResponsiveBehavior = function () {
347348
var elt_tabs = $(".pfc-tabs");
348349
var elt_users = $(".pfc-users");
@@ -470,6 +471,23 @@ var phpFreeChat = (function (pfc, $, window, undefined) {
470471
};
471472

472473

474+
/**
475+
* Load specific javascript defined by the theme
476+
*/
477+
pfc.loadThemeUI = function () {
478+
$('link').each(function (i, link) {
479+
var href = $(link).attr('href');
480+
if (new RegExp("\/client\/themes\/").test(href)) {
481+
var base_url = href.replace(/[^\/]+$/, '');
482+
var theme_ui_url = base_url + 'theme.js';
483+
$.ajax({
484+
url: theme_ui_url,
485+
dataType: "script",
486+
cache: true
487+
});
488+
}
489+
});
490+
};
473491

474492
return pfc;
475493
}(phpFreeChat || {}, jQuery, window));

client/pfc-utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode
2828
* Todo: make it a jquery plugin
2929
*/
3030
pfc.modalbox = {
31+
isopen: false,
3132
open: function (html) {
33+
this.isopen = true;
3234
html = $(html);
3335
$('div.pfc-modal-box *').remove();
3436
$('div.pfc-modal-box').append(html).fadeIn();
@@ -42,6 +44,7 @@ fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode
4244
return html;
4345
},
4446
close: function (now) {
47+
this.isopen = false;
4548
if (now) {
4649
$('div.pfc-modal-box').hide();
4750
$('div.pfc-modal-overlay').hide();
@@ -61,6 +64,6 @@ fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode
6164
}).trigger('resize');
6265
}
6366
};
64-
67+
6568
return pfc;
6669
}(phpFreeChat || {}, jQuery, window));

client/themes/carbon/theme.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Specific javascript for the current theme
3+
*/
4+
$(document).ready(function() {
5+
// the phpfreechat jquery plugin instance
6+
var pfc = phpFreeChat;
7+
8+
// do what you need, you can for example:
9+
// - inject HTML into the chat structure
10+
// ex: $(pfc.element).find('.pfc-content').wrap('<div class="pfc-theme-wrapper" />');
11+
// - add ergonomics effects to the DOM (ex: new event handlers)
12+
// - ...
13+
14+
});

client/themes/default/theme.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Specific javascript for the current theme
3+
*/
4+
$(document).ready(function() {
5+
// the phpfreechat jquery plugin instance
6+
var pfc = phpFreeChat;
7+
8+
// do what you need, you can for example:
9+
// - inject HTML into the chat structure
10+
// ex: $(pfc.element).find('.pfc-content').wrap('<div class="pfc-theme-wrapper" />');
11+
// - add ergonomics effects to the DOM (ex: new event handlers)
12+
// - ...
13+
14+
});

client/themes/gamer/theme.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Specific javascript for the current theme
3+
*/
4+
$(document).ready(function() {
5+
// the phpfreechat jquery plugin instance
6+
var pfc = phpFreeChat;
7+
8+
// do what you need, you can for example:
9+
// - inject HTML into the chat structure
10+
// ex: $(pfc.element).find('.pfc-content').wrap('<div class="pfc-theme-wrapper" />');
11+
// - add ergonomics effects to the DOM (ex: new event handlers)
12+
// - ...
13+
14+
});
990 Bytes
Loading
13.4 KB
Loading
9.43 KB
Loading
1.36 KB
Loading
1.5 KB
Loading

0 commit comments

Comments
 (0)