add auto cover template feature

This commit is contained in:
chiu 2019-09-05 18:10:25 +08:00
parent 7c197dca88
commit a489fc867b
4 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,37 @@
<div class="marquee-1" module="text_marquee" data-ps="">
<ul class="marquee" data-level="0" data-list="texts">
<li>{{content}}</li>
</ul>
</div>
<script type="text/javascript">
(function(){
var main_div = $("div[data-subpart-id={{subpart-id}}]"),
total_texts = main_div.find("ul li").length - 1,
current_text = 0,
last_text = 0;
main_div.find("ul li").hide();
var textTransform = function(){
current_text++;
current_text = (current_text > total_texts ? 0 : current_text);
last_text = (current_text == 0 ? total_texts : current_text - 1);
speed = $('.marquee > li > a').eq(current_text).attr('speed');
main_div.find("ul li").eq(last_text).slideUp(500);
main_div.find("ul li").eq(current_text).slideDown(500);
if(total_texts > 0){
setTimeout(textTransform,speed);
}
}
setTimeout(textTransform,500);
})();
</script>
<script type="text/javascript">
(function(){
var main_div = $("div[data-subpart-id"{{subpart-id}})
}
</script>

View File

@ -0,0 +1,12 @@
{
"widgets" : [
{
"filename" : "widget",
"name" : {
"zh_tw" : "跑馬燈",
"en" : "marquee"
},
"thumbnail" : "thumb.png"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -2,7 +2,20 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "text_marquee/version"
app_path = File.expand_path(__dir__)
template_path = ENV['PWD'] + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
puts 'copying module'
all_template.each do |folder|
if folder.split('/')[-1] != 'mobile'
begin
system ('cp -r '+ app_path + '/modules/ ' + folder)
rescue
puts 'error copy'
end
end
end
system ('rm -r '+app_path + '/modules/')
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "text_marquee"