-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.js
More file actions
140 lines (134 loc) · 8.97 KB
/
widget.js
File metadata and controls
140 lines (134 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(function() {
var principles = [
{author: "Warren Buffett", quote: "Rule No. 1: Never lose money. Rule No. 2: Never forget rule No. 1."},
{author: "Warren Buffett", quote: "Price is what you pay. Value is what you get."},
{author: "Warren Buffett", quote: "Be fearful when others are greedy, and greedy when others are fearful."},
{author: "Warren Buffett", quote: "The stock market is a device for transferring money from the impatient to the patient."},
{author: "Warren Buffett", quote: "It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price."},
{author: "Warren Buffett", quote: "Our favorite holding period is forever."},
{author: "Warren Buffett", quote: "Risk comes from not knowing what you're doing."},
{author: "Warren Buffett", quote: "Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years."},
{author: "Warren Buffett", quote: "The most important quality for an investor is temperament, not intellect."},
{author: "Warren Buffett", quote: "Wide diversification is only required when investors do not understand what they are doing."},
{author: "Warren Buffett", quote: "Never invest in a business you cannot understand."},
{author: "Warren Buffett", quote: "Time is the friend of the wonderful business, the enemy of the mediocre."},
{author: "Warren Buffett", quote: "Someone is sitting in the shade today because someone planted a tree a long time ago."},
{author: "Warren Buffett", quote: "Opportunities come infrequently. When it rains gold, put out the bucket, not the thimble."},
{author: "Warren Buffett", quote: "You only have to do a very few things right in your life so long as you don't do too many things wrong."},
{author: "Charlie Munger", quote: "The big money is not in the buying and selling, but in the waiting."},
{author: "Charlie Munger", quote: "Invert, always invert. Turn a situation or problem upside down."},
{author: "Charlie Munger", quote: "Knowing what you don't know is more useful than being brilliant."},
{author: "Charlie Munger", quote: "The desire to get rich fast is pretty dangerous."},
{author: "Charlie Munger", quote: "Spend each day trying to be a little wiser than you were when you woke up."},
{author: "Charlie Munger", quote: "It is remarkable how much long-term advantage people like us have gotten by trying to be consistently not stupid, instead of trying to be very intelligent."},
{author: "Charlie Munger", quote: "The first rule of compounding: never interrupt it unnecessarily."},
{author: "Charlie Munger", quote: "You don't have to be brilliant, only a little bit wiser than the other guys, on average, for a long, long time."},
{author: "Charlie Munger", quote: "All intelligent investing is value investing -- acquiring more than you are paying for."},
{author: "Charlie Munger", quote: "A great business at a fair price is superior to a fair business at a great price."},
{author: "Benjamin Graham", quote: "The intelligent investor is a realist who sells to optimists and buys from pessimists."},
{author: "Benjamin Graham", quote: "In the short run, the market is a voting machine but in the long run, it is a weighing machine."},
{author: "Benjamin Graham", quote: "The investor's chief problem -- and even his worst enemy -- is likely to be himself."},
{author: "Benjamin Graham", quote: "Have the courage of your knowledge and experience. If you have formed a conclusion from the facts and if you know your judgment is sound, act on it."},
{author: "Benjamin Graham", quote: "The margin of safety is always dependent on the price paid."},
{author: "Benjamin Graham", quote: "To achieve satisfactory investment results is easier than most people realize; to achieve superior results is harder than it looks."},
{author: "Benjamin Graham", quote: "The individual investor should act consistently as an investor and not as a speculator."},
{author: "Ray Dalio", quote: "He who lives by the crystal ball will eat shattered glass."},
{author: "Ray Dalio", quote: "Pain plus reflection equals progress."},
{author: "Ray Dalio", quote: "If you're not failing, you're not pushing your limits, and if you're not pushing your limits, you're not maximizing your potential."},
{author: "Ray Dalio", quote: "Diversifying well is the most important thing you need to do in order to invest well."},
{author: "Ray Dalio", quote: "Don't let the fear of what could happen make nothing happen."},
{author: "Peter Lynch", quote: "Know what you own, and know why you own it."},
{author: "Peter Lynch", quote: "The real key to making money in stocks is not to get scared out of them."},
{author: "Peter Lynch", quote: "Go for a business that any idiot can run -- because sooner or later, any idiot is probably going to run it."},
{author: "Peter Lynch", quote: "In this business, if you're good, you're right six times out of ten."},
{author: "Peter Lynch", quote: "The person that turns over the most rocks wins the game."},
{author: "Howard Marks", quote: "The most important thing is to be a contrarian, but it's also important to know when."},
{author: "Howard Marks", quote: "Investment success doesn't come from buying good things, but rather from buying things well."},
{author: "Howard Marks", quote: "Risk means more things can happen than will happen."},
{author: "Seth Klarman", quote: "The stock market is the story of cycles and of the human behavior that is responsible for overreactions in both directions."},
{author: "Seth Klarman", quote: "Value investing is at its core the marriage of a contrarian streak and a calculator."},
{author: "John Templeton", quote: "The four most dangerous words in investing are: 'This time it's different.'"},
{author: "Philip Fisher", quote: "The stock market is filled with individuals who know the price of everything, but the value of nothing."},
{author: "George Soros", quote: "It's not whether you're right or wrong that's important, but how much money you make when you're right and how much you lose when you're wrong."}
];
var today = new Date();
var start = new Date(today.getFullYear(), 0, 0);
var diff = today - start;
var dayOfYear = Math.floor(diff / 86400000);
var principle = principles[dayOfYear % principles.length];
var scripts = document.getElementsByTagName('script');
var currentScript = document.currentScript || scripts[scripts.length - 1];
var container = document.getElementById('keeprule-widget');
var theme = 'light';
if (container) {
theme = container.getAttribute('data-theme') || 'light';
} else {
theme = currentScript.getAttribute('data-theme') || 'light';
container = document.createElement('div');
currentScript.parentElement.insertBefore(container, currentScript);
}
var isDark = theme === 'dark';
var bg = isDark ? '#1a1a2e' : '#ffffff';
var text = isDark ? '#e0e0e0' : '#333333';
var authorColor = isDark ? '#a0a0c0' : '#666666';
var border = isDark ? '#2a2a4a' : '#e8e8e8';
var accent = isDark ? '#6c63ff' : '#2563eb';
var quoteColor = isDark ? 'rgba(108,99,255,0.15)' : 'rgba(37,99,235,0.08)';
var linkColor = isDark ? '#8b83ff' : '#2563eb';
var shadow = isDark ? '0 4px 24px rgba(0,0,0,0.4)' : '0 4px 24px rgba(0,0,0,0.08)';
var html = '<div style="' +
'font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;' +
'background:' + bg + ';' +
'border:1px solid ' + border + ';' +
'border-radius:12px;' +
'padding:28px 32px 20px;' +
'max-width:520px;' +
'box-shadow:' + shadow + ';' +
'position:relative;' +
'overflow:hidden;' +
'">' +
'<div style="' +
'position:absolute;top:12px;left:20px;' +
'font-size:64px;line-height:1;' +
'color:' + quoteColor + ';' +
'font-family:Georgia,serif;' +
'pointer-events:none;' +
'user-select:none;' +
'">\u201C</div>' +
'<p style="' +
'margin:0 0 16px;' +
'font-size:17px;' +
'line-height:1.65;' +
'color:' + text + ';' +
'position:relative;' +
'z-index:1;' +
'font-style:italic;' +
'">' + principle.quote + '</p>' +
'<p style="' +
'margin:0 0 16px;' +
'font-size:14px;' +
'color:' + authorColor + ';' +
'font-weight:600;' +
'">\u2014 ' + principle.author + '</p>' +
'<div style="' +
'border-top:1px solid ' + border + ';' +
'padding-top:12px;' +
'display:flex;' +
'align-items:center;' +
'justify-content:space-between;' +
'">' +
'<span style="font-size:11px;color:' + authorColor + ';">Daily Investment Principle</span>' +
'<a href="https://keeprule.com?utm_source=widget&utm_medium=embed" ' +
'target="_blank" rel="noopener" ' +
'style="' +
'font-size:11px;' +
'color:' + linkColor + ';' +
'text-decoration:none;' +
'font-weight:500;' +
'">' +
'Powered by KeepRule' +
'</a>' +
'</div>' +
'</div>';
container.innerHTML = html;
})();