mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 03:05:25 +08:00
decf1f27cf
* Phase 0 for user-selectable theme components - Drops `key` column from the `themes` table - Drops `theme_key` column from the `user_options` table - Adds `theme_ids` (array of ints default []) column to the `user_options` table and migrates data from `theme_key` to the new column. - Removes the `default_theme_key` site setting and adds `default_theme_id` instead. - Replaces `theme_key` cookie with a new one called `theme_ids` - no longer need Theme.settings_for_client
82 lines
2.4 KiB
Plaintext
82 lines
2.4 KiB
Plaintext
<!DOCTYPE html>
|
|
<html<%= raw @embeddable_css_class -%>>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<%= discourse_stylesheet_link_tag 'embed', theme_id: nil %>
|
|
<%- unless customization_disabled? %>
|
|
<%= discourse_stylesheet_link_tag :embedded_theme %>
|
|
<%- end %>
|
|
<%= preload_script 'break_string' %>
|
|
|
|
<%- if @topic_view && @topic_view.page_title.present? %>
|
|
<title><%= @topic_view.page_title %> - <%= SiteSetting.title %></title>
|
|
<%- end %>
|
|
|
|
<script>
|
|
(function() {
|
|
|
|
function postUp(msg) {
|
|
if (parent) {
|
|
parent.postMessage(msg, '<%= request.referer %>');
|
|
}
|
|
}
|
|
|
|
function clickPostLink(e) {
|
|
var postId = e.target.getAttribute('data-link-to-post');
|
|
if (postId) {
|
|
var postElement = document.getElementById('post-' + postId);
|
|
if (postElement) {
|
|
var rect = postElement.getBoundingClientRect();
|
|
if (rect && rect.top) {
|
|
postUp({type: 'discourse-scroll', top: rect.top});
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
window.onload = function() {
|
|
// get state info from data attribute
|
|
var header = document.querySelector('header');
|
|
var state = 'unknown';
|
|
if (header) {
|
|
state = header.getAttribute('data-embed-state');
|
|
}
|
|
|
|
// Send a post message with our loaded height and state
|
|
postUp({type: 'discourse-resize', height: document['body'].offsetHeight, state: state});
|
|
|
|
var postLinks = document.querySelectorAll("a[data-link-to-post]"),
|
|
i;
|
|
|
|
for (i=0; i<postLinks.length; i++) {
|
|
postLinks[i].onclick = clickPostLink;
|
|
}
|
|
|
|
// Make sure all links in the iframe point to _blank
|
|
var cookedLinks = document.querySelectorAll('.cooked a');
|
|
for (i=0; i<cookedLinks.length; i++) {
|
|
cookedLinks[i].target = "_blank";
|
|
}
|
|
|
|
// Adjust all names
|
|
var names = document.querySelectorAll('.username a');
|
|
for (i=0; i<names.length; i++) {
|
|
var username = names[i].innerHTML;
|
|
if (username) {
|
|
names[i].innerHTML = new BreakString(username).break();
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<%= yield %>
|
|
</body>
|
|
</html>
|